users@jsr311.java.net

Re: PathSegment question

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Thu, 04 Dec 2008 14:22:02 -0500

On Dec 4, 2008, at 11:14 AM, Sergey Beryozkin wrote:
>
> Suppose we have
>
> @GET @Path("bar{foo:.+}")
> public String get(PathParam("foo") PathSegment ps,
> PathParam("foo") String s) {}
>
> GET /bar/foo/baz
>
> the value of the second paramater is "/foo/baz"
>
> what is value of ps.getPath() ?
>
> should it be 'foo' or 'foo/bar' ?
>
It should be 'bar'. See the javadoc of @PathParam: "the value will be
the final segment of the matching part of the path".

A type of List<PathSegment> can be used to get ['foo', 'bar'].

Marc.

>>

---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.