Issue 7[1]:
"To help with URI construction it would be useful for a resource class
to be able to access the list of resources whose sub-resource locators
were used to find the resource class."
This has come up several times on the users list recently, I propose
to add a new method to UriInfo as follows:
/**
* Get a map of relative URI to resource class instance. Each key
represents
* a partial path that matched a resource class, a sub-resource
method or
* a sub-resource locator. Each value is the instance of the resource
class
* for the corresponding key. When iterating the map, the keys are
ordered
* according to request URI matching order, with the root resource
first.
* E.g.:
*
* <pre>@Path("foo")
*public class FooResource {
* @GET
* public String getFoo() {...}
*
* @Path("bar")
* @GET
* public String getFooBar() {...}
*
* @Path("baz")
* public BazResource getFooBaz() {...}
*}</pre>
*
* <p>A request <code>GET /foo</code> would return a map with a
single key:
* "foo" whose value is an instance of FooResource</p>
*
* <p>A request <code>GET /foo/bar</code> would return a map with two
keys
* in the following order: "foo" whose value is an instance of
* <code>FooResource</code> and "bar" whose value is an instance of
* <code>FooResource</code></p>
*
* <p>A request <code>GET /foo/baz</code> would return a map with two
keys
* in the following order: "foo" whose value is an instance of
* <code>FooResource</code> and "baz" whose value is an instance of
* <code>BazResource</code></p>
*
* @return a map of URI to resource class instance.
*/
public Map<URI, Object> getResourceAncestry();
Any objections, enhancements ?
Marc.
[1]
https://jsr311.dev.java.net/issues/show_bug.cgi?id=7
---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.