Lift and Cappuccino integration... a first step

15 views
Skip to first unread message

David Pollak

unread,
Sep 3, 2009, 6:10:41 PM9/3/09
to objec...@googlegroups.com, liftweb
Folks,

Hearkening back to my NextStep days, I took a dive into Cappuccino today.  Yep... Obj-J is just like Obj-C and Cappuccino faithfully captures AppKit goodness.

I've integrated Lift with Cappuccino.  The integration points are as follows:
  1. A Lift application serves the Cappuccino application.  This means that one could mix a "web style" Lift based app with a could of "app style" Cappuccino-based application pages.
  2. Cappuccino can initiate calls to Lift via Ajax.  The call from Cap looks like: performAjaxCall([input stringValue]); where there's been a binding a Lift JSON message handler to the performAjaxCall function.  The binding looks like:
    Script(
        Function("performAjaxCall", List("param"), JsonVar.is._1("hello", JsVar("param"))) &
        JsonVar.is._2)
  3. Lift can initiate calls into a Cappuccino app via Lift's Comet support.  Here's the Lift code that's necessary to create a clock that ticks every 3 seconds in the Cap app:
      override def highPriority = {
        case 'Ping =>
          partialUpdate(currentTime)
          ActorPing.schedule(this, 'Ping , 3 seconds)
      }

      def currentTime: JsCmd = JsRaw("clockCallback("+(""+now).encJs+");")
    Plus the following line that must appear in the page that contains the Cap app:
    <lift:comet type="Clock"/>
A running version of the Lift/Cappuccino integrated app can be found at http://frothy.liftweb.net/

The source can be found at http://github.com/dpp/Frothy/tree/master  (please don't laugh at/vomit on my ObjJ code... it's been 15 years since I did ObjC).

Thanks,

David

--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

Daniel Daley

unread,
Sep 3, 2009, 6:19:05 PM9/3/09
to lif...@googlegroups.com
Wow, great stuff! 

I was considering looking into using Cappuccino but was afraid of the integration troubles with Lift. Now I think I'll take a second look, I've always been a fan of Obj-C.


--Dan--

TylerWeir

unread,
Sep 3, 2009, 10:24:21 PM9/3/09
to Lift
Stupendous stuff Dave!

On Sep 3, 6:10 pm, David Pollak <feeder.of.the.be...@gmail.com> wrote:
> Folks,
>
> Hearkening back to my NextStep days, I took a dive into Cappuccino today.
> Yep... Obj-J is just like Obj-C and Cappuccino faithfully captures AppKit
> goodness.
>
> I've integrated Lift with Cappuccino.  The integration points are as
> follows:
>
>    1. A Lift application serves the Cappuccino application.  This means that
>    one could mix a "web style" Lift based app with a could of "app style"
>    Cappuccino-based application pages.
>    2. Cappuccino can initiate calls to Lift via Ajax.  The call from Cap
>    looks like: performAjaxCall([input stringValue]); where there's been a
>    binding a Lift JSON message handler to the performAjaxCall function.  The
>    binding looks like:
>    Script(
>        Function("performAjaxCall", List("param"), JsonVar.is._1("hello",
>    JsVar("param"))) &
>        JsonVar.is._2)
>    3. Lift can initiate calls into a Cappuccino app via Lift's Comet
>    support.  Here's the Lift code that's necessary to create a clock that ticks
>    every 3 seconds in the Cap app:
>      override def highPriority = {
>        case 'Ping =>
>          partialUpdate(currentTime)
>          ActorPing.schedule(this, 'Ping , 3 seconds)
>      }
>
>      def currentTime: JsCmd = JsRaw("clockCallback("+(""+now).encJs+");")
>    Plus the following line that must appear in the page that contains the
>    Cap app:
>    <lift:comet type="Clock"/>
>
> A running version of the Lift/Cappuccino integrated app can be found athttp://frothy.liftweb.net/
>
> The source can be found athttp://github.com/dpp/Frothy/tree/master (please
> don't laugh at/vomit on my ObjJ code... it's been 15 years since I did
> ObjC).
>
> Thanks,
>
> David
>
> --
> Lift, the simply functional web frameworkhttp://liftweb.net
> Beginning Scalahttp://www.apress.com/book/view/1430219890

Heiko Seeberger

unread,
Sep 4, 2009, 4:33:21 AM9/4/09
to lif...@googlegroups.com
Very exciting!

2009/9/4 David Pollak <feeder.of...@gmail.com>



--
Heiko Seeberger

My job: weiglewilczek.com
My blog: heikoseeberger.name
Follow me: twitter.com/hseeberger
OSGi on Scala: scalamodules.org
Lift, the simply functional web framework: liftweb.net

Indrajit Raychaudhuri

unread,
Sep 4, 2009, 4:39:36 AM9/4/09
to Lift
Great stuff. Now how about an archetype for this?

Cheers, Indrajit

On Sep 4, 3:10 am, David Pollak <feeder.of.the.be...@gmail.com> wrote:
> Folks,
>
> Hearkening back to my NextStep days, I took a dive into Cappuccino today.
> Yep... Obj-J is just like Obj-C and Cappuccino faithfully captures AppKit
> goodness.
>
> I've integrated Lift with Cappuccino.  The integration points are as
> follows:
>
>    1. A Lift application serves the Cappuccino application.  This means that
>    one could mix a "web style" Lift based app with a could of "app style"
>    Cappuccino-based application pages.
>    2. Cappuccino can initiate calls to Lift via Ajax.  The call from Cap
>    looks like: performAjaxCall([input stringValue]); where there's been a
>    binding a Lift JSON message handler to the performAjaxCall function.  The
>    binding looks like:
>    Script(
>        Function("performAjaxCall", List("param"), JsonVar.is._1("hello",
>    JsVar("param"))) &
>        JsonVar.is._2)
>    3. Lift can initiate calls into a Cappuccino app via Lift's Comet
>    support.  Here's the Lift code that's necessary to create a clock that ticks
>    every 3 seconds in the Cap app:
>      override def highPriority = {
>        case 'Ping =>
>          partialUpdate(currentTime)
>          ActorPing.schedule(this, 'Ping , 3 seconds)
>      }
>
>      def currentTime: JsCmd = JsRaw("clockCallback("+(""+now).encJs+");")
>    Plus the following line that must appear in the page that contains the
>    Cap app:
>    <lift:comet type="Clock"/>
>
> A running version of the Lift/Cappuccino integrated app can be found athttp://frothy.liftweb.net/
>
> The source can be found athttp://github.com/dpp/Frothy/tree/master (please
> don't laugh at/vomit on my ObjJ code... it's been 15 years since I did
> ObjC).
>
> Thanks,
>
> David
>
> --
> Lift, the simply functional web frameworkhttp://liftweb.net
> Beginning Scalahttp://www.apress.com/book/view/1430219890

Timothy Perrett

unread,
Sep 4, 2009, 4:01:22 PM9/4/09
to lif...@googlegroups.com
Right now there is *a lot* of deep changes going on in the capp
codebase... IMHO, lets wait until 0.8 is released then make an
archetype against that.

Cheers, Tim

Indrajit Raychaudhuri

unread,
Sep 5, 2009, 6:47:36 AM9/5/09
to lif...@googlegroups.com
Yes, that makes sense. Apart from the usual configuration and filtering
activities, downloading and merging the Cappuccino stuff during
archetype:generate could be interesting addition.

Cheers, Indrajit

David Pollak

unread,
Sep 5, 2009, 9:58:16 AM9/5/09
to lif...@googlegroups.com
I think we'll have to do the archetype outside of the main Lift repository/distribution (although it would still be available on Maven).  Cappuccino has a ton of LGPL code in it and itself is LGPL.  I'd rather not mix licensing models in the stuff we keep in the main Lift repository.
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890

Timothy Perrett

unread,
Sep 5, 2009, 12:58:21 PM9/5/09
to Lift
Fair do's.... lets certainly make it a wiki article however because im
sure many people will be interested in this.

Cheers, Tim

On Sep 5, 2:58 pm, David Pollak <feeder.of.the.be...@gmail.com> wrote:
> I think we'll have to do the archetype outside of the main Lift
> repository/distribution (although it would still be available on Maven).
>  Cappuccino has a ton of LGPL code in it and itself is LGPL.  I'd rather not
> mix licensing models in the stuff we keep in the main Lift repository.
>
> On Sat, Sep 5, 2009 at 3:47 AM, Indrajit Raychaudhuri
> <indraj...@gmail.com>wrote:

Indrajit Raychaudhuri

unread,
Sep 5, 2009, 2:53:43 PM9/5/09
to Lift
Indeed. it's important for Lift archetypes to be able to 'pull' the
prerequisites from 'known places' (great if available in a maven repo,
explicitly fetch otherwise).
This Cappuccino archetype presents a scenario where we would certainly
have to do this.

Licensing being one strong reason, the other two being weaker coupling
on versions and lightening up Lift's codebase by avoiding additional
'payload' within.

IMHO, we might even go all the way and have Lift follow similar
strategy even withing it's framework licensing or no licensing.
Particularly for JS and CSS libraries instead of having them (a)
'bloat' the codebase and (b) force Lift as a framework be responsible
by default for version updates (bug and security fixes) of these
libraries.

Cheers, Indrajit


On Sep 5, 6:58 pm, David Pollak <feeder.of.the.be...@gmail.com> wrote:
> I think we'll have to do the archetype outside of the main Lift
> repository/distribution (although it would still be available on Maven).
>  Cappuccino has a ton of LGPL code in it and itself is LGPL.  I'd rather not
> mix licensing models in the stuff we keep in the main Lift repository.
>
> On Sat, Sep 5, 2009 at 3:47 AM, Indrajit Raychaudhuri
> <indraj...@gmail.com>wrote:
Reply all
Reply to author
Forward
0 new messages