Re: Platonic URIs

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Wed, 26 Sep 2007 15:41:46 -0400

On Sep 25, 2007, at 7:05 AM, Paul Sandoz wrote:
> I don't think it makes sense to support:
> /collection.xml/1
> /collection.xml/1.xml
> The suffices only makes sense on last path segment of the URI.
The use of sub-resource methods will make this quite complex and
possibly counter-intuitive. Would it make sense to match the URIs
above but to simply ignore the extensions on the path segments
matched to the parent class. E.g.

@UriTemplate(value="collection" extensions=true)
public class SomeResource {

   SomeCollection getAll(@UriExtensions String exts[]) {

   @UriTemplate(value="{id}" extensions=true)
   SomeItem getItem(@UriParam("id") String itemId, @UriExtensions
String exts[]) {

With the above you want both

GET /collection.xml, and
GET /collection/1.xml

to work so it could be tricky to disallow GET /collection.xml/1.xml
since the URI to resource class matching algorithm first has to match
the SomeResource class before it can match the getItem method.


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