tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: troubleshooting getPathInfo in jsp files
Date Tue, 14 Dec 2010 21:35:30 GMT
Hash: SHA1


On 12/14/2010 3:49 PM, Gary Lawrence Murphy wrote:
> <path-info><%= request.getPathInfo() %></path-info>
> <path-translated><%= request.getPathTranslated() %></path-translated>
> <query-string><%= request.getQueryString() %></query-string>


> when called with http://localhost:8080/test.jsp it reports three nulls

That seems appropriate to me.

> when called with http://localhost:8080/test.jsp?query it reports the
> query-string

With or without the '?'?

> however when called with http://localhost:8080/test.jsp/this it fails as a
> 404 not found

Actually, this makes sense to me: the default mapping for the JSP
servlet is "*.jsp". Your path doesn't end in .jsp, and therefore does
not match the url-pattern.

> by comparison, on a resin-4 server running the same jsp code, same os and
> java version
> when called with http://localhost:8080/test.jsp it reports
> <path-info>/test</path-info>

That's strange: pathinfo should be everything /after/ the URL of the
resource that handled the request. I would have expected "" (or null)
for path-info.

> <path-translated>/opt/resin-4/webapps/ROOT/test</path-translated>

path-translated will only return a value if path-info has a value. It's
interesting what Resul has chosen to return for the path-translated
value: the "base name" of the .jsp file on the filesystem.

> and when called with http://localhost:8080/test.jsp/this?query it gives the
> expected
> <path-info>/test</path-info>
> <path-translated>/opt/resin-4/webapps/ROOT/test</path-translated>
> <query-string>query</query-string>

This URL actually does have a path-info string (relative to "/test.jsp").

I'm not sure how Tomcat is supposed to divine that /test.jsp/test is, in
fact, a request to /test.jsp in disguise.

> what could I have messed up in the installation?  could tomcat6 be
> encountering a conflicting jar file before its expected version? do I need
> to enable some feature to get pathinfo parsing on jsp files?

I think you need to add a url-mapping for the JSP servlet. Maybe
something like '/test.jsp/*'?

- -chris
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message