users@jersey.java.net

Re: [Jersey] using Lift templates with Jersey (was Re: [Jersey] custom TemplateProcessor not having its constructor injected?)

From: James Strachan <james.strachan_at_gmail.com>
Date: Fri, 24 Apr 2009 09:19:22 +0100

2009/4/24 Paul Sandoz <Paul.Sandoz_at_sun.com>:
> On Apr 23, 2009, at 10:26 AM, James Strachan wrote:
>>>>
>>>> Contributions welcome :)
>>>>
>>>
>>> It looks like they are willing to support the abstraction your require. I
>>> am
>>> not currently sure how this will work with some of the lift features that
>>> seem quite integrated with the templates. I remember scratching my head
>>> wondering how the snippet concept could be integrated with resource
>>> classes.
>>
>> Yeah. Fingers crossed it works out OK - failing that we could always
>> just fork the code and rip out the Ajax bits and just do a simple
>> version of Lift's templates; thats compatible with the snippets stuff
>> but doesn't include the whole thing. Though hopefully we can just
>> reuse lift; plus then folks can always use 'real lift' and JAXRS side
>> by side using the same codebase.
>>
>
> Yes. I know that another developer was using Jersey and lift side-by-side
> but in their case Jersey was used to serve data (so the Jersey filter was
> utilized).

Yeah - I've got Lift & Jersey working fine together; they are just
separate filters really, its no biggie. Its harder getting them to
work together in the same request :)


>>> Is this this the start of a jersey-scala module ? :-)
>>
>> It could be :). When I've something more interesting than the previous
>> bit of code I'll probably pop it up on github first; being neither a
>> committer in Jersey or Lift - its then up to other folks to pull it
>> into Jersey/Lift as they see fit.
>
> If you like i can grant you the Developer role for Jersey. I think given the
> patches you have submitted you clearly know what is going on :-)

Awesome thanks! :) I'll start hacking up a jersey-scala and
jersey-lift module... :)

Would the contrib's place be the best place to put them?

I guess we could have jersey-scala as a library, which just provides
one or two helpers for using vanilla Scala and JAXRS/Jersey together
(e.g. to put the fairly trivial NodeWriter which writes NodeSeq types;
so folks can use Scala resource beans like this...

@Path("/bar")
class BarResource {

  @GET
  @Produces(Array("text/html"))
  def view() = <html><body><h1>Hello World!</h1></body></html>
}

we could modify the samples/scala-hello-world to reuse the (very
trivial) jersey-scala library to show how markup can be created
directly in resource beans in scala like above.

We could maybe use Scala Nodes or List/Tuple/Map to create a JSON writer too?


Then I was thinking there could be a separate jersey-lift library to
add lift template support (which would also depend on liftweb). It
might be there ends up being a few different template options in the
Scala world; there's lifts, then Sweetscala uses freemarker
http://code.google.com/p/sweetscala/wiki/MvcView

folks might wanna use JSP/Velocity too maybe and maybe there'll be
others. I saw a JSP-with-scala like thing the other day but can't find
it now.


>> Any plans to move Jersey to git BTW? :) It'd make contributing add ons
>> much easier...
>>
>
> Tempting. I have considered moving over to Kenai.com and then we could get
> git or hg support, but am concerned about the disruption this might cause
> e.g. does NetBeans support git?

Dunno - IDEA has great git support btw :) It is a bit of a PITA to
move things like the website though..

-- 
James
-------
http://macstrac.blogspot.com/
Open Source Integration
http://fusesource.com/