tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: troubleshooting getPathInfo in jsp files
Date Tue, 14 Dec 2010 21:35:30 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Gary,

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>

Ok.

> 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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk0H4yIACgkQ9CaO5/Lv0PCI8ACcCQAkN/2cePUg4hVTclrDY4TS
ydcAoIn/XrIX1egB4ALEM4pgIoVSdNvB
=J69B
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message