users@jersey.java.net

Re: [Jersey] Static references from JSP

From: Daniel Shaw <java_at_dshaw.com>
Date: Wed, 11 Feb 2009 11:40:10 -0500

James,

This is a huge help. Thank you.

Daniel Shaw
e: mail_at_dshaw.com
p: +1 304 680-5858
i: http://dshaw.com
c: http://www.linkedin.com/in/dshaw



On Tue, Feb 10, 2009 at 11:24 AM, James Strachan
<james.strachan_at_gmail.com> wrote:
> 2009/1/31 sarat.pediredla <sarat.pediredla_at_gmail.com>:
>>
>> Hi all,
>>
>> Just to add to this thread and get some clarification.
>>
>> Is the bottom line now that I cannot use Jersey with static resources? I was
>> hoping to replace Struts 2 (which I mainly use for MVC rather than the
>> extraneous stuff) with Jersey in a new project and consider my dismay when I
>> realised that if I set Jersey to map to /* then I could not serve ANY static
>> resources.
>>
>> In Struts 2, all I had to do was add a filter before the Struts 2 filter to
>> just forward to the static resource (JS, CSS, Image) etc.
>
> Yeah that approach should work with Jersey too
>
>
>> With Jersey using a servet in web.xml I figured this is not possible at all.
>>
>> In summary, is there an easy way to have Jersey as my "main" web framework
>> and have it handle (or not handle and just pass through to Tomcat), requests
>> for *.js , *.css etc?
>
> There's a patch here
> https://jersey.dev.java.net/issues/show_bug.cgi?id=208
>
> which builds on Paul's servlet filter work to add a regex property to
> the servlet filter so you can configure what servlet paths are static
> content and let your web container serve those up. I wonder if you
> could try that patch out on your web application and see if it does
> the trick?
>
> If you apply the patch you'll see the bookstore example serves up some
> static content (/css/style.css) and see the use of the regex in the
> web.xml
>
> --
> James
> -------
> http://macstrac.blogspot.com/
>
> Open Source Integration
> http://fusesource.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>