users@jersey.java.net

[Jersey] Re: Jersey request introspection question

From: Miroslav Fuksa <miroslav.fuksa_at_oracle.com>
Date: Thu, 6 Mar 2014 15:21:45 +0100

Hi Justyna,

Jersey 2.x does not have any API which would tell you to which resource and resource method the request will match. Neither validation is fully publicly exposed. If you want to use introspection modeler, you can use Resource builder API. Example:

Resource resource = Resource.builder(MyJaxRsResource.class).build();
and then use resource to get information about resource (IntrospectionModeller is used to construct Resource).

See https://jersey.java.net/documentation/latest/resource-builder.html

Mira

On Mar 6, 2014, at 1:19 AM, Justyna Horwat <justyna_at_apple.com> wrote:

> Does Jersey have a mechanism to find out whether or not a Jersey enabled service will handle a given request?
>
> For example, I'd like to plug Jersey into a set of factory handlers. As the request comes in, I want a way to take a look at the request and determine which handler is the appropriate one to handle the request before handing the request over to it.
>
> Does Jersey expose any mechanism that would tell me for a given request whether or not any of the service's Jersey annotations?
>
> I don't want to start the whole Jersey lifecycle, ideally I'd like to use bits and pieces of existing Jersey API's to do the introspection and validation. The most promising class, IntrospectionModeller, is no longer public with Jersey 2.x. Is there something similar with Jersey 2.x?
>
> Thanks,
>
> Justyna