users@jsr311.java.net

path segments, slashes and request matching

From: Stephan Feder <sf_at_b-i-t.de>
Date: Thu, 30 Oct 2008 12:10:24 +0100

Hello,

(please CC me because I am not subscribed)

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() { .... }
}

I would have written in the spec

3.4.1 footnote 2: removed

3.7.2.1 (c) dot 2: Remove members for which the final regular expression
capturing group (henceforth simply referred to as a capturing group) value
is not empty and the class associated with R(Tclass ) had no sub-resource
methods or locators.

3.7.2.2 (a) If U *is null*, set ...

3.7.2.2 (d) dot 2: Remove members derived from Tmethod (those added in
step 2(c)i) for which the final capturing group value is not empty.

3.7.3.4: removed

3.7.3.5: Append '(.*)?'€™to the result.

and in javax.ws.rs.Path: Identifies the part of an URI path that a
resource class or class method will serve requests for. Path parts are are
combined to paths by string concatenation. The path of an annotated class
is the concatenation of the path of the application context and the path
part of the class. The path of an annotated method is the concatenation of
the path of the containing class and the path part of the method.

and in javax.ws.rs.core.UriBuilder:

path(java.lang.Class): Append the path part from a Path-annotated class to
the existing path.

path(java.lang.Class, java.lang.String): Append the path part from a
Path-annotated method to the existing path. This method is a convenience
shortcut to path(Method), it can only be used in cases where there is a
single method with the specified name that is annotated with Path.

path(java.lang.reflect.Method): Append the path part from a Path-annotated
method to the existing path.

path(java.lang.String path): Append path to the existing path. Existing
'/' characters are preserved thus a single value can represent multiple
URI path segments.

segment(java.lang.String...): Append path segments to the existing path.
When constructing the final path, the supplied segments will be separated
by '/'. Existing '/' characters are encoded thus a single value can only
represent a single URI path segment.


Assuming that all Path annotations would state exactly which slashes they
expect I do not see any regression.

Comments?

Regards
        Stephan