users@jersey.java.net

[Jersey] Re: Jersey2: How to map URI to Resource?

From: cowwoc <cowwoc_at_bbs.darktech.org>
Date: Tue, 05 Nov 2013 16:54:11 -0500

Hi Marek,

     Here is a simple example:

POST /calls/31298
{
   "from": "/calls/3124532/participants/31",
   "to": "/calls/3124532/participants/32"
}

     This creates a connection between participants 31 and 32. How is
the server supposed to honor this request? In Jersey 1.0 I would resolve
each URI back to a resource. Each resource contains the following methods:

long getId();
URI getUri();

     So, once I've got the resource, I invoke getId() to get the
database identifier and create the connection. When someone invokes GET
/connections/321213 I convert the database id to a resource and from
there invoke getUri(). I take the resulting URI and add it to the
response body.

     What am I supposed to do in Jersey 2.0?

Thanks,
Gili

On 05/11/2013 3:55 PM, Marek Potociar wrote:
> Hi Gili,
>
> This is not supported in Jersey 2 at the moment. When considering the old ResourceContext API we could not agree how useful the feature as well as how to address the processing of the new JAX-RS filters and entity interceptors in that method.
>
> What is the use case where you would need the method? What behavior do you expect from (pre-matching and post-matching) filters and interceptors in that use case?
> Answering these questions will help us in our considerations whether we should re-introduce the old API somehow or come up with a better concept.
>
> Thanks,
> Marek
>
> On 25 Oct 2013, at 18:56, cowwoc <cowwoc_at_bbs.darktech.org> wrote:
>
>> Hi,
>>
>> I posted this question at http://stackoverflow.com/q/17284419/14731. What replaces ResourceContext.matchResource(URI)? How do we go from a URI back to a resource class?
>>
>> Thanks,
>> Gili