Hi Gregg,
As Trolly says configure Jersey using a filter.
I dunno why there is a difference in behavior for "/" and "/*" servlet
URL patterns. This also occurs for GlassFish that shares the same
Tomcat code. I recommend not using "/" at all as i doubt it is portable.
Paul.
On Mar 6, 2010, at 2:03 AM, Gregg Carrier wrote:
> I know this is probably a Tomcat problem, but I'm hoping someone may
> have run into this issue and can offer some advice.
>
> Desired behavior: I want all requests to my webapp to be handled by
> Jersey except requests for index.jsp or the root of the webapp. I do
> not want trailing slashes to be required in order to load URLs.
>
> The setups I have tried and the results:
>
> 1 - <servlet-mapping>
> <servlet-name>Jersey Spring Web Application</servlet-name>
> <url-pattern>/</url-pattern>
> </servlet-mapping>
>
> <welcome-file-list>
> <welcome-file>index.jsp</welcome-file>
> </welcome-file-list>
>
> In this case, the index.jsp loads fine at /mywebapp/. The servlet
> handles all other requests appropriately EXCEPT it requires a
> trailing slash at the end of all URLs. Eg, /mywebapp/foo/ loads but /
> mywebapp/foo does not. This setup would be perfect except for the
> trailing slash requirement. I want it to load with or without the
> trailing slash.
>
> 2 - <servlet-mapping>
> <servlet-name>Jersey Spring Web Application</servlet-name>
> <url-pattern>/*</url-pattern>
> </servlet-mapping>
>
> <welcome-file-list>
> <welcome-file>index.jsp</welcome-file>
> </welcome-file-list>
>
> With this setup the servlet handles requests with and without the
> trailing slash (correctly). The index.jsp will not load at /
> mywebapp/ or /mywebapp/index.jsp.
>
> Any ideas? Thanks very much!
>
> Gregg