dev@glassfish.java.net

Re: Possible bug in servlet

From: <Jan.Luehe_at_Sun.COM>
Date: Fri, 06 Jun 2008 17:45:19 -0700

Paul Sandoz wrote:

> Jan.Luehe_at_Sun.COM wrote:
>
>> A request for
>>
>> http://localhost:8080/HelloWorldWebApp
>>
>> will cause a redirect to
>>
>> http://localhost:8080/HelloWorldWebApp/
>>
>> which matches your servlet.
>>
>
> I still think there may be an issue because the information returned
> from HttpServletRequest is inconsistent. Namely, i observe:
>
> request.getPathInfo() = "/"
> request.getRequestURI() = "/HelloWorldWebApp"
> request.getRequestURL() = "http://localhost:8080/HelloWorldWebApp"
>
> i.e. the latter two should end in a '/' if redirection correctly is
> performed.
>
> I presume an internal redirect is performed: I just checked using curl
> and no 303 response is returned.
>
> Is the redirection GF specific behavior? Is it possible to switch it off?


I'm trying to find the exact quote from the Servlet spec, but Section
10.10 (Welcome Files) has this:

  A request URI of /foo will be redirected to a URI of /foo/.

I've verified (using telnet) that a redirect is actually being returned:

  GET /123 HTTP/1.0

  HTTP/1.1 302 Moved Temporarily
  X-Powered-By: Servlet/2.5
  Location: http://leah:8080/123/
  Content-Type: text/html; charset=iso-8859-1
  Date: Sat, 07 Jun 2008 00:37:17 GMT
  Connection: close


Jan

>
> Paul.
>