-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Nathan,

At this point, all discussion is academic because you sound like you
are stuck with what you've got. I would recommend fixing the apparent
bugs in your replacement default servlet, but I don't get to make
requirements decisions on your project :)

On 10/17/2011 11:29 PM, Nathan Potter wrote:
> I seem to be exploring the set of all possible mapping
> permutations.
> 
> When you change the mapping to "/" from "/*" the methods 
> HttpServletRequest.getPathInfo() and 
> HttpServletRequest.getPathTranslated() change their output from a
> useful string to null.

You shouldn't be using getPathTranslated, anyway, as there is no
guarantee that a physical file system actually exists.
getPathTranslated uses getPathInfo and returns null when there is no
"path info", so the behavior of these methods are kind of locked-together.

getPathInfo will return everything after the servlet path. When using
"/*" I have no idea what the servlet path will be, especially when you
also have "/hyrix/*" or whatever mapped to the same URL. Technically,
the servlet maps in two ways -- I would expect the longest path-match
to be selected first (as spec requires it) so you get the behavior of
/foo and /hyrox/foo being essentially the same request. I have no idea
why you'd want that behavior, but hey, it's your webapp.

If you use "/" as the url-pattern, the servlet will get requests that
don't match anything else. It's *not* a prefix mapping, it's a default
mapping. I'm not surprised that getPathInfo goes to null when you use
it, since the entire URI ends up being the "servlet path" and there's
nothing else left-over for the path info.

I'm curious as to why you are using getPathInfo in the first place.
Are you or are you not serving static content? Are you expecting to
look for resources on the filesystem? I still don't really understand
why Tomcat's DefaultServlet doesn't meet your needs. If all you really
need is /hyrix/* to look like /*, then that can be done with
server-side forwarding using something like URLRewrite (as suggested
by another poster at some point).

> Additionally the HttpServletRequest.getServletPath() method which
> has somewhat different semantics when the mapping is "/" rather
> than "/*".

Yes. Essentially, getServletPath and getPathInfo will slice-up the
request URI in different ways depending upon the url-mapping you have
given it in web.xml.

> The web application uses all three of those methods and not very 
> flexible in the way that it does so.

That's a shame.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk6dzxIACgkQ9CaO5/Lv0PBRWACfSfLiV2R9tucSrTYEgiGEEfPD
3vcAnj3pfStK9lADJVMfiLOlWzlclK4J
=2Aqs
-----END PGP SIGNATURE-----

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

Reply via email to