dev@glassfish.java.net

Re: Possible bug in servlet

From: <Jan.Luehe_at_Sun.COM>
Date: Thu, 05 Jun 2008 14:56:26 -0700

Paul,

Paul Sandoz wrote:

> Hi,
>
> I am using GFv2 UR2 with Jersey. If say my web.xml is:
>
> <web-app>
> <servlet>
> <servlet-name>Jersey Web Application</servlet-name>
>
> <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
>
> <load-on-startup>1</load-on-startup>
> </servlet>
> <servlet-mapping>
> <servlet-name>Jersey Web Application</servlet-name>
> <url-pattern>/*</url-pattern>
> </servlet-mapping>
> </web-app>
>
> and i deploy the application using the context "HelloWorldWebApp" and
> i access the service with this URL:
>
> http://localhost:8080/HelloWorldWebApp
>
> then Jersey gets invoked.
>
> The "request.getPathInfo()" is returning "/", which seems incorrect to
> me.
>
> In fact i don't think the servlet with the URL pattern "/*" should get
> invoked at all for such a request URL does, since that URL does not
> match the pattern.


A request for

  http://localhost:8080/HelloWorldWebApp

will cause a redirect to

  http://localhost:8080/HelloWorldWebApp/

which matches your servlet.


Jan