tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anand Bashyam Narasimham <ana...@digitalthink.com>
Subject RE: getPathInfo problem
Date Thu, 06 Dec 2001 20:23:36 GMT
Craig,

I see the whole picture now. As regards to the question I did look into the
Specs and for JSPs this must return "null" and for URL mapped Servlet it
must return the path that the servlet is called with.

Thanks all for your help finding this out.

Anand

-----Original Message-----
From: Craig R. McClanahan [mailto:craigmcc@apache.org]
Sent: Wednesday, December 05, 2001 10:18 PM
To: Anand Bashyam Narasimham
Subject: RE: getPathInfo problem


You still haven't said what you think the *right* answer is, or what
*wrong* answer you think this page returns.  PLEASE be complete.

When I try this on your server, it returns the source code of the JSP page
itself (which means your server is not set up to handle JSP pages
correctly).

On my server running Tomcat 4.0.1, this returns null for both
getPathInfo() and getPathTranslated().

Note that this is the correct answer!  Because JSP pages are mapped using
a "*.jsp" mapping, there will never be a non-null value for getPathInfo(),
since the extension match has to happen on the last element of the request
URI only.

If you want the context relative path of the page itself (if your context
path is "/thriftytest", this would be "/anand/pathtest/test.jsp"), you
should call request.getServletPath() instead.

If you want the physical disk pathname of this file (assuming you are
running out of a directory, not a WAR file), you should call:

  String path = getServletContext().getRealPath(request.getServletPath());

Craig


On Wed, 5 Dec 2001, Anand Bashyam Narasimham wrote:

> Date: Wed, 5 Dec 2001 14:13:39 -0800
> From: Anand Bashyam Narasimham <anandn@digitalthink.com>
> To: 'Craig R. McClanahan' <craigmcc@apache.org>
> Subject: RE: getPathInfo problem
>
> Ok,
>
> Here's a URL that you can try:-
>
> http://www.learningcircle.net/thriftytest/anand/pathtest/test.jsp
>
> The code in this JSP is as follows:-
> <-----------------------------------Code Starts
> here--------------------------->
> <html>
>
> <b>The Path Info is <%=request.getPathInfo()%>::Path Translated
> ="<%=request.getPathTranslated()%></b><br>
> Request URI is --><%=request.getRequestURI()%>
>
> </html>
> <-----------------------------------Code Ends
> here----------------------------->
>
> I did see another reply that says that these calls will not return correct
> values from a JSP. Is this true if yes then would the same calls work from
a
> Servlet.
>
> Thanks
>
> Anand
> -----Original Message-----
> From: Craig R. McClanahan [mailto:craigmcc@apache.org]
> Sent: Wednesday, December 05, 2001 12:01 PM
> To: Tomcat Developers List
> Cc: Anand Bashyam Narasimham
> Subject: Re: getPathInfo problem
>
>
>
>
> On Wed, 5 Dec 2001, Anand Bashyam Narasimham wrote:
>
> > Date: Wed, 5 Dec 2001 11:32:08 -0800
> > From: Anand Bashyam Narasimham <anandn@digitalthink.com>
> > Reply-To: Tomcat Developers List <tomcat-dev@jakarta.apache.org>
> > To: "Tomcat Dev Mailing List (E-mail)" <tomcat-dev@jakarta.apache.org>
> > Subject: getPathInfo problem
> >
> > Hi,
> >
> > I know there's been a lot of discussion around this and the bug filed
says
> > it's a "WORKSFORME" but somehow if I just install TOmcat3.3 and run the
> > Snoop JSP in the example I get a "null" on getPathInfo as well as
> > getPathTranslated(). Is there something that needs to be set on the
> servlet
> > mapping etc.
> >
> > If some on can give a concrete answer as to why this is so much a
problem
> it
> > would be of great help. I tried a JSP with calls to getPathInfo() and
> > getPathTranslated() on WebLogic 5.1 and the getPathTranslated works fine
> but
> > returns null in Tomcat.
> >
> > Anand
> >
>
> As I asked for (twice!) in the bug report dialog, can you please provide a
> test case that shows exactly what you think is wrong?  The original
> statement in the bug report was not correct, and you have not provided the
> detail of exactly what behavior you are seeing, and what you are
> expecting.
>
> Without that, there's nothing anyone here can do.
>
> Craig McClanahan
>

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message