You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Geoff Soutter <ge...@whitewolf.com.au> on 2000/08/21 11:05:28 UTC

[PATCH] fix default servlets requestURI != contextPath + servletPath + pathInfo

Hi there,

Heres the fix for the bug I reported earlier. Pretty easy actually, just
replace the the case statement at around 400 in
request.SimpleMapper1.fixRequestPaths() with

        case Container.DEFAULT_MAP:
            /*
             patched to fix following bug, not sure if this is perfect tho
             since this code seems unecessarily cryptic...
             - "/context"  => context="/context" servletpath="/"
pathinfo=null
               should be   => context="/context" servletpath=""
pathinfo=null
             - "/context/" => context="/context" servletpath="/"
pathinfo="/"
               should be   => context="/context" servletpath="/"
pathinfo=null
            s="/";
            pathI= path.substring( ctxPLen ) ;
            */
            s = path.substring( ctxPLen );
            pathI = null;
            if( debug>0 ) log( "Default map " + s + " " + pathI );
            break;

Cheers

Geoff


Re: [PATCH] fix default servlets requestURI != contextPath + servletPath + pathInfo

Posted by Geoff Soutter <ge...@whitewolf.com.au>.
"Hans Bergsten" <ha...@gefionsoftware.com> wrote:
> Geoff Soutter wrote:
> > There may be a mistake in this. the spec if not clear is in the case of
a
> > path "/context" whether
> > the servletpath ought to be "" or null. The patch as stabds returns ""
but I
> > think null is clearer.
> >
> > Would any servlet API "experts" on the list like to comment on this
issue?
>
> This has been discussed back and forth in the "expert group" more times
than I
> care to remember, and I'm pretty sure the correct value is "" (null is not
> defined
> as a valid return value for getServletPath() according to the JavaDocs).
> Unless it really breaks something real bad, please let it be as it is now.
> The latest Servlet Errata
> (<http://java.sun.com/products/servlet/errata_042700.html>)
> does not describe this exactly, but "" seem to be in line with the case
> described
> in the errata.

Thanks for the response, Hans.

Whatever "the experts" think is cool with me :-), so we can let the patch
stand as it is.

If anyone would like to commit the patch as it stands then 3.3 would be
getting closer to spec compliant :-)

cheers

Geoff





Re: [PATCH] fix default servlets requestURI != contextPath + servletPath + pathInfo

Posted by Hans Bergsten <ha...@gefionsoftware.com>.
Geoff Soutter wrote:
> 
> Hi there again
> 
> There may be a mistake in this. the spec if not clear is in the case of a
> path "/context" whether
> the servletpath ought to be "" or null. The patch as stabds returns "" but I
> think null is clearer.
> 
> Would any servlet API "experts" on the list like to comment on this issue?

This has been discussed back and forth in the "expert group" more times than I 
care to remember, and I'm pretty sure the correct value is "" (null is not
defined
as a valid return value for getServletPath() according to the JavaDocs).
Unless it really breaks something real bad, please let it be as it is now.
The latest Servlet Errata
(<http://java.sun.com/products/servlet/errata_042700.html>)
does not describe this exactly, but "" seem to be in line with the case
described
in the errata.

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

Re: [PATCH] fix default servlets requestURI != contextPath + servletPath + pathInfo

Posted by se...@eng.sun.com.
Thank you for your feedback on the Servlet API. Your feedback will be
read by an engineer on the Java Servlet API Team and given serious
consideration. We will contact you directly if we have further
questions about your feedback.

----------------------------------------------------------------------

We do not perform sales or technical support from this address.  This
is worth repeating: you will not receive any additional mail, unless
we have questions on your feedback. Please contact one of our other
support channels (below) if you require support.

To place a bug report directly into our database, you may enter your
bug here: http://java.sun.com/cgi-bin/bugreport.cgi

For licensing, sales and schedule information, please contact
1-888-THEJAVA. If outside the US, please dial 1-(512)434-1591

----------------------------------------------------------------------

For more discussion of the servlet API please consider joining the
servlet-interest mailing list.

You may subscribe to the mailing list by sending an email to:

LISTSERV@JAVASOFT.COM

with the _body_ of the message containing the line

SUBSCRIBE SERVLET-INTEREST Full-Name-Here

where Full-Name-Here is your name.

Discussions of programming Java Servlets, and server side Java
programming in general, are carried out on the Usenet newsgroup
comp.lang.java.programmer.

----------------------------------------------------------------------

Thank you for your time and input.

The Servlet API Team

Re: [PATCH] fix default servlets requestURI != contextPath + servletPath + pathInfo

Posted by Geoff Soutter <ge...@whitewolf.com.au>.
Hi there again

There may be a mistake in this. the spec if not clear is in the case of a
path "/context" whether
the servletpath ought to be "" or null. The patch as stabds returns "" but I
think null is clearer.

Would any servlet API "experts" on the list like to comment on this issue?

cheers

Geoff
----- Original Message -----
From: "Geoff Soutter" <ge...@whitewolf.com.au>
To: <to...@jakarta.apache.org>
Sent: Monday, August 21, 2000 7:05 PM
Subject: [PATCH] fix default servlets requestURI != contextPath +
servletPath + pathInfo


> Hi there,
>
> Heres the fix for the bug I reported earlier. Pretty easy actually, just
> replace the the case statement at around 400 in
> request.SimpleMapper1.fixRequestPaths() with
>
>         case Container.DEFAULT_MAP:
>             /*
>              patched to fix following bug, not sure if this is perfect tho
>              since this code seems unecessarily cryptic...
>              - "/context"  => context="/context" servletpath="/"
> pathinfo=null
>                should be   => context="/context" servletpath=""
> pathinfo=null
>              - "/context/" => context="/context" servletpath="/"
> pathinfo="/"
>                should be   => context="/context" servletpath="/"
> pathinfo=null
>             s="/";
>             pathI= path.substring( ctxPLen ) ;
>             */
>             s = path.substring( ctxPLen );
>             pathI = null;
>             if( debug>0 ) log( "Default map " + s + " " + pathI );
>             break;
>
> Cheers
>
> Geoff
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
>
>