users@jersey.java.net

Re: [Jersey] is there a way to get hold of the resource bean from inside a MessageBodyWriter? (and Lift templates are kinda working...)

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Thu, 14 May 2009 10:26:56 +0200

Hi James,

Yah!

This is possible as that functionality is utilized by the JSP
integration (the "it" object). I am writing this from a SunRay at the
moment and do not have access to the code, and i will be away for the
day, so i will have to get back to with more details tomorrow and
recommend you have a look at the JSP code in the interim.

Paul.



On 05/14/09 09:56 AM, James Strachan wrote:
> I can get hold of the body (the return value of the resource method)
> from the MessageBodyWriter interface and I can get the
> request/response/context/servletcontext injected - I'm just wondering
> if there's a clever way of getting the resource bean itself?
>
> The background to this is I've just about got Lift templates to work
> with Jersey (yay!) - using implicit views or having a Scala resource
> method return a template instance
> http://github.com/jstrachan/liftweb/tree/master/lift-jersey
>
> (currently the code depends on master of liftweb and might need a few
> more lift tweaks to be complete, so I'm thinking for now the code
> might be best inside the lift project itself)
>
> I'd like to expose the resource bean so it can be used by lift
> snippets in a canonical way, whether via the LiftTemplateProcessor or
> via the NodeWriter...
> http://github.com/jstrachan/liftweb/tree/master/lift-jersey/src/main/scala/net/liftweb/jersey/test/
>
> but wasn't sure yet how to find it from inside NodeWriter - anyone any ideas?
>