On May 22, 2008, at 11:14 AM, Stephan Koops wrote:
>
> does anyone knows a usecase where it is useful to require
> @Path("{var}/{var}"), with respect to the resource oriented
> architecture?
> As Paul said, IMO everytime @Path("{varA}/{varB}") would work.
> If there is no usecase, let forbid it. Or at least let recommend to
> not use it and accept unexpected behaviours, if not both {var}s
> matches the same value.
> Than we have no problems with {"1", "3/4"} or {"1", "3", "4"}.
>
Even if we disallow having the same var name twice in a path value, I
think there's still a question of what the value of p should be for:
GET 1/2/3
with:
@Path(value="{var}" limited=false)
public class Resource {
@GET
public Result get(@PathParam("var") PathSegment p) {...}
}
or
@Path(value="{var}" limited=false)
public class Resource {
@GET
public Result get(@PathParam("var") List<PathSegment> p) {...}
}
Even if we decide to not support @PathParam with List<T> we still need
to decide what p should be for the first example. If p were a String
I'd currently expect "1/2/3" but we could define it to be "3" with
List<String> giving {"1","2","3"} and do a similar thing for
PathSegment.
Marc.
---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.