On Oct 10, 2009, at 7:15 AM, Dinesh Narayanan wrote:
> Hello,
> I developed a small JAX-RS app that worked fine when deployed in
> Jetty. Now when I try to deploy this in Websphere 7.0.0.3,
>
> I ran into the following issues
> a) static files are not accessible even though I have the following
> entry in web.xml
> <filter>
> <filter-name>JerseyFilter</filter-name>
> <filter-
> class>com.sun.jersey.spi.container.servlet.ServletContainer</filter-
> class>
> <init-param>
> <param-name>com.sun.jersey.config.feature.Redirect</
> param-name>
> <param-value>true</param-value>
> </init-param>
> <init-param>
> <param-
> name>com.sun.jersey.config.feature.ImplicitViewables</param-name>
> <param-value>true</param-value>
> </init-param>
> <init-param>
> <param-name>com.sun.jersey.config.property.packages</
> param-name>
> <param-
> value
> >
> com
> .brocade
> .webportal
> .common
> ;com
> .brocade
> .webportal.myAccount.resource;com.brocade.webportal.myHome.resource</
> param-value>
> </init-param>
> <init-param>
> <param-
> name>com.sun.jersey.config.property.WebPageContentRegex</param-name>
> <param-value>/(image|css|js|dojo)/.*</param-value>
> </init-param>
> </filter>
> <filter-mapping>
> <filter-name>JerseyFilter</filter-name>
> <url-pattern>/*</url-pattern>
> </filter-mapping>
>
I am guessing there must be some different filtering behavior between
Glassfish, Jetty (and IIRC Tomcat) and WebSphere. I do not know how to
solve this as do not have any experience with WebSphere.
If the regex matches the path then the Jersey filter will call the
next filter in the chain:
// if we match the static content regular expression lets
delegate to the filter chain
// to use the default container servlets & handlers
Pattern p = getStaticContentPattern();
if (p != null && p.matcher(servletPath).matches()) {
chain.doFilter(request, response);
return;
}
> b) When I try to access uri "http://localhost:9084/GuicyMyBrocadeWeb/login
> ", it prefixes "/" by default for certain resources ("http://localhost:9084/GuicyMyBrocadeWeb/login/
> "). The wierd thing is that this happens only for a few URIs. And
> this triggers two GET requests
> i) one for "http://localhost:9084/GuicyMyBrocadeWeb/login" -
> Firebug showed me 302 status
302 or 307? Jersey never automatically returns a 302.
> ii) one for "http://localhost:9084/GuicyMyBrocadeWeb/login/") -
> 404 status
>
If you set the property "com.sun.jersey.config.feature.Redirect" to
true then automatic redirection will occur (307) from a non-"/"-
terminated URL to a "/"-terminated URL if the value of the @Path ends
in a "/".
I am guessing you have @Path("login/") ?
(note that the above description is available from the JavaDoc, but
java.net is down so i cannot point you to it at the moment).
Paul.
>
> Not sure if I need to set
> 'com.ibm.ws.webcontainer.invokeFiltersCompatibility' to true in WAS
> 7.0.0.x. Anyway setting it to true
> also did not work. The logs indicate Jersey got initialized correctly.
>
> [10/9/09 21:57:45:575 PDT] 00000017 PackagesResou I Scanning for
> root resource and provider classes in the packages:
> com.brocade.webportal.common
> com.brocade.webportal.myAccount.resource
> com.brocade.webportal.myHome.resource
> [10/9/09 21:57:45:591 PDT] 00000017 PackagesResou I Root resource
> classes found:
> class com.brocade.webportal.myHome.resource.MyHomeResource
> class com.brocade.webportal.myAccount.resource.HelloWorldResource
> class com.brocade.webportal.common.resource.LoginResource
> class com.brocade.webportal.myAccount.resource.MyAccountResource
> class com.brocade.webportal.common.resource.UserResource
> class com.brocade.webportal.common.resource.MenuResource
> [10/9/09 21:57:45:606 PDT] 00000017 PackagesResou I Provider
> classes found:
> [10/9/09 21:57:45:794 PDT] 00000017 WebApplicatio I Initiating
> Jersey application, version 'Jersey: 1.1.2-ea 08/25/2009 04:39 PM'
>
>
> Googling also did not help me much. Did somebody get Jersey up and
> running on WAS 7.0. Help would be really appreciated here. I would
> really like to use
> Jersey for my new Apps
>
> Thanks
> Dinesh