Stephan,
In my 2nd example, regardless of extension mapping or content negotiation, I suspect the code would like to have different methods to find methods and dependencies.
@Path(“java”)
class CodeResource {
@GET
@Path(“{class}/methods”, limited=false)
public List<String> getMethods(@PathParam(“class”) String cls) { … }
@GET
@Path(“{class}/dependencies”, limited=false)
public List<Class> getDependencies(@PathParam(“class”) String cls) { … }
}
I believe the @Path values on these methods are invalid in the current spec.
Changing the 3 @Path annotations to “java/{class}/”, “methods”, and “dependencies” will not work either as the unlimited {class} placeholder will consume the whole URI, leaving nothing to match the method @Paths.
Swapping the order of the class and method/dependencies does NOT improve these URIs (in my opinion).
http://example.net/java/java/lang/Integer/methods.json
http://example.net/java/javax/ws/rs/core/Request/methods.xml
http://example.net/java/javax/ws/rs/core/Request/dependencies.xml
vs
http://example.net/java/methods/java/lang/Integer.json
http://example.net/java/methods/javax/ws/rs/core/Request.xml
http://example.net/java/dependencies/javax/ws/rs/core/Request.xml
The first style of URI feels important enough for JAX-RS to support, but I don’t have hard evidence.
James Manger
_____________________________________________
From: Stephan.Koops_at_web.de [mailto:Stephan.Koops_at_web.de]
Sent: Wednesday, 2 July 2008 5:35 PM
To: users_at_jsr311.dev.java.net
Hi James,
I think it is a more common case, that you have a fix start of the path and the different ends of the path to be matched. But perhaps we could support both with a new attribute, analogue to limited.
Let's see, what the others say.
BTW: You could handle the file extensions the the extension mapping, and use the http content negotiation, or leave the extension out. IMO you should not hardcode the file extensions.
_____________________________________________
From: Manger, James H [mailto:James.H.Manger_at_team.telstra.com]
Sent: Wednesday, 2 July 2008 4:33 PM
To: users_at_jsr311.dev.java.net
Subject: JAX-RS: @Path limited=false templates: (?!/).+(?<!/)
…
2. A Java source code repository;
http://example.net/java/java/lang/Integer/methods.json
http://example.net/java/javax/ws/rs/core/Request/methods.xml
http://example.net/java/javax/ws/rs/core/Request/dependencies.xml
=> @Path(value="java/{class}/methods.{format}", limited=false)