users@jsr311.java.net

Re: path segments, slashes and request matching

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Thu, 30 Oct 2008 10:42:43 -0400

On Oct 30, 2008, at 7:10 AM, Stephan Feder wrote:
>
> the 1.0 spec insists on operating on path segments (i.e. slashes are
> implied all over the place). This is unnecessarily limitating.
>
> The following pseudo example does not do what I expect (it matches
> "index./html" instead of "index.html").
>
> @Path("index.")
> public class Index {
>
> @GET @Path("html") @Produces("text/html")
> public Response html() { ... }
>
> @GET @Path("xml") @Produces("text/xml")
> public Response xml() { .... }
> }
>
At one point we did support extension-based conneg in the spec but we
removed it following negative feedback. You can get the kind of
functionality you want by including the "index." in your method path
templates (removing it from the class level @Path) or by introducing a
second level dispatch with a template like "index.{ext}".

> I would have written in the spec
>
<snip/>

> Assuming that all Path annotations would state exactly which slashes
> they expect I do not see any regression.
>
That's an assumption I don't think we can make, the changes you
suggest would introduce a backwards compatibility problem.

Marc.

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