tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <ma...@apache.org>
Subject Re: Path parameters and getRequestURI
Date Wed, 08 Feb 2012 21:34:25 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 08/02/2012 21:25, Christopher Schultz wrote:
> Mark,
> 
> On 2/8/12 3:37 PM, Mark Thomas wrote:
>> On 08/02/2012 20:35, Christopher Schultz wrote:
>>> Can anyone think of a reason I can't just [chop-off everything
>>>  after the first ";"]?
> 
>> Yes. Path parameters can occur at any part of the path.
> 
> So a URI could look like this:
> 
> /context/something;p1=val;p2=val/morestuff

Yes.

> ... and that URI would match /context/something/morestuff as a 
> uri-pattern for, say, filter or servlet mappings?

Yes, as per section 12.1 of the 3.0 servlet spec (and equivalent in
earlier versions).

> Does Tomcat attempt to ignore path parameters when going these
> types of matches? (I'd read the code, but the mapper is, as you
> know... complex).

The real trick is knowing that you don't need to look at the mapper
code :). Of course, it helps if you remember that you wrote the code
in question ;) Take a look at CoyoteAdapter#parsePathParameters()

> Path segments are separated by / characters, so perhaps I could
> adjust my "ignore the path parameters" algorithm to work like
> this:
> 
> Starting from the end of the URI, rewind until I hit a "/", then
> go forward until I hit a ";", then trim forward from the ";".

They can also be on the final path segment (and usually are).

> Or, I could just say "ignore anything like 
> ';jsessionid=[0-9A-Za-z]*'", but that's a little presumptuous and 
> potentially fragile as well.

Indeed.

Unfortunately, the servlet spec is far from clear on how path
parameters should be handled. I hope to get clarity in 3.1 with [1]

Mark

[1] http://java.net/jira/browse/SERVLET_SPEC-18

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

iQIcBAEBAgAGBQJPMupgAAoJEBDAHFovYFnnmSYP/2lFZ3r6d1t8o+HnoEfHFYqj
X5ycDq+75DHrX/thLjoQzfYF1BxhtiimEnSJDW+bXgMLC/5dEh10VtE2vpMgh9PX
CxNELhtJ5jFezSPSaqH9lh9L+2v6sCqFM9F4KOuSk3dU+bWenBhqwE8dYxspITU6
KnsXjvYKUnl7pI867eTQji0I3uPnirW5s/RkFKY4YIPtkTniCfwF8Z+x7s6tylOQ
fcWUcT5w3WDsWTnkNxcIngqvAYDMM7olHrS7DToU8RXmd8/8yEpVXyfCS2Ftu5zI
0VzFuYpas9TOOB0Ke6uEwtQvZ1kUbUfwpB4DoUv6iXrLr9sMUufzzAYhV2kC0uOY
++8XaFzGc9jxAZiuJrRpWDF1OuXAvTXbKjVFKY4PSvEZZEofAJbMgPtAcA+IFjVg
VaZzMl68rvzsId7WAzMRhHrNZJl+SvJ1T/z1lrjqyNNuXg6o0eVLSZkvy7QbJ7BR
cPGhCq7YQ7QpqAUOu4xUhPmET0eoCtBgcc9gGiS0oUT4OQKmqfQC3BVUmSJ9eJy9
qYkBTfqVqLXn7YL5XW3U0V/d+J6rZGXHZhhr1Sr0PPXG2vC0fk2w+wJy2JyznWOa
sZlHEddZ5OmxXNnUlQuZSas1hLGcKUCQre3f74KV0Q/ULoa1Kp+xq0+B9XZnvVYH
aT9fN7DspB9aP1mui/GL
=Iwkm
-----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