Hi there,

i am trying to model a case where endpoints are exposed both as root and as 
sub-resources. That is, the mapping can be:


I have defined both a Project and a Task endpoint. 

Currently in my 'Project' endpoint, I've defined a subresource locator of the 

public TaskEndpoint listTasks(@PathParam("id") Long id) {
 return new TaskEndpoint(id, em);

In the TasksEndpoint i initialise the class with the id of the project, so any 
listing of the tasks will retrieve only the tasks with the project_id set to 
the parameter. 

This works correctly only if remove the @Path annotation from the TaskEndpoint. 
But then I can't access the Tasks as root.

Further using the 'new' looses the injection capabilities (e.g. of an entity 
manager in the TaskEndpoint). That's the reason for the 'em' param also.

So my questions is, what is the recommended approach for exposing endpoints as 
both root and sub resources.. and without loosing the injection mechanism?


Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
Resteasy-users mailing list

Reply via email to