users@jersey.java.net

Re: [Jersey] Jersey and Sitemesh

From: James Strachan <james.strachan_at_gmail.com>
Date: Fri, 30 Jul 2010 09:46:07 +0100

On 30 July 2010 09:22, Paul Sandoz <Paul.Sandoz_at_oracle.com> wrote:
>
> On Jul 30, 2010, at 10:06 AM, Alexandru Popescu ☀ wrote:
>
>> Quick status update:
>>
>> 1. pluggin in sitemesh worked without any issues
>
> Great.
>
>
>> 2. unfortunately I don't seem to find a way to access the entity from
>> the sitemesh decorators. While I know this is not always a good idea,
>> I would have liked the possibility. Any thoughts?
>>
>
> Unfortunately i don't understand enough about sitemesh to help you much
> there. Is the entity from the decorator available from servlet artifacts?
>
> In Jersey it is possible to inject the ServletContext/Config and
> HttpServletRequest.

SiteMesh is a filter; I've had it working in the past on a number of
Jersey projects

e.g. camel-web is currently using Jersey + Sitemesh (well until it
gets ported to scalate :)...
http://camel.apache.org/web-console.html

here's the working web.xml (notice the use of WebPageContentRegex)
http://svn.apache.org/viewvc/camel/trunk/components/camel-web/src/main/webapp/WEB-INF/web.xml?view=markup

The main issue with SiteMesh is making sure Jersey lets other
JSPs/static files be rendered by the servlet container rather than
assuming anything outside of the Jersey filter is a 404. I can't
remember but I might have had an ordering issue too way back when; the
order you define filters might be important.

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