cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <blorit...@infoplanning.com>
Subject Re: CoocoonServlet.java, getServletPath() and TomCat
Date Fri, 14 Jul 2000 13:14:22 GMT
Stuart Roebuck wrote:
> 
> Under TomCat 3.1, getPathInfo() works, but getServletPath() returns an
> empty string.

:(

Many servlet vendors don't implement getPathInfo for some reason.  But I
think they pretty much all support getRequestURI.

> 
> In my mind the Servlet 2.2 spec. would imply that getPathInfo() was the
> correct method to use.

This is the response from Gefion's tech team.

This is an area of the spec that has always been interpreted in
different ways by different vendors. We have recently discussed this
in the servlet specification group, and for a servlet mapped to the /
pattern, the context relative path shall be returned by the getServletPath()
method and getPathInfo() returns null. If this is not what Tomcat 
returns, it's a bug in Tomcat.

Hans
-- 
Hans Bergsten           hans@gefionsoftware.com
Gefion Software         http://www.gefionsoftware.com

> Therefore, why not either:
> 
> 1.  Use context.getServerInfo() to check for specific cases like "Gefian
> LWS and Orion" and return getServletPath() for them only.

-1.  The added checking shouldn't be necessary.  Your second proposal will
     work.

> 2.  Check to see whether
>                 uri =
> req.getRequestURI().substring(req.getContextPath().length());
>         is a possible alternative (it works under Tomcat 3.1, but I don't know
>         about the rest).

+1.  I already know that getRequestURI works with all three vendors I tried.
     Of course, when I didn't do the substring method I needed to be in the
     root context.

> 
> Hope this is helpful,

It is.  The req.getRequestURI method works without problem.  In fact, the
tech folks at Gefion suggested the use of either getServletPath or getRequestURI.
They suggested the getServletPath method for servlets that were to be mapped
to '/'.

Mime
View raw message