Hey Martin,
well I've worked on my own RESTful framework based on Serlvet for
several years now, and built 3-4 apps on it.
It resembles JAX-RS a great deal: tree of resources/subresources,
singletons/root classes, HTTP methods, representations etc, but uses
object-oriented methods rather than annotations.
However I can see (with my current knowledge) several features that
JAX-RS could benefit from:
1. a way for the resources to access their parent resource (class) in the tree
2. a way for resource instances to access their own URI during
request, as opposed to the request URI.
Maybe an injectable class like ResourceInfo would do, as a supplement
to UriInfo.
3. an easier way for the resource to check if it is a leaf of the
matching resource tree, i.e. that it matches the URI to the last path
segment. Maybe an annotation like @Leaf would be useful to prevent
attaching any subresources.
4. a way to define a relationship between the URI template param like
@Path("{id}") and the subresource method from which the param is
built, maybe reusing @PathParam() annotation, e.g.
public class RootResource
{
@Path("{id}")
public SubResource getSubResource()
{
return new SubResource(id);
}
}
public class SubResource
{
private String id = null;
public SubResource(@PathParam("id") String id)
{
this.id = id;
}
@PathParam("id") // marks method used as "id" template param
public String getId()
{
return id;
}
}
It would not be of much use when looking up resources, but could help
building them in case my #2 suggestion is implemented (it's what I
used the abstract Resource.getPath() method for).
Sorry if some of this is already present in JAX-RS, I've only been
developing with it for about a week.
Hope this helps.
Martynas
semantic-web.dk
On Thu, Mar 10, 2011 at 6:52 PM, Martin Matula <martin.matula_at_oracle.com> wrote:
> Hi Martynas,
>
> On 10.3.2011 16:23, Martynas Jusevicius wrote:
> ....
>>
>> I see this as a normal (if not common) RESTful use case, so I'm pretty
>> unimpressed that JAX-RS doesn't help out here :)
>
> We welcome proposals for improvements. :)
> Martin
>