mockobject
mockobject

Reputation: 1827

Can I get the ResourceMethodRegistry being used by Resteasy

The ResourceMethodRegistry in Resteasy is used in resolving a HttpRequest to an actual method call for the uri, method, content type, etc in the request. Is the actual populated instance of this registry that RestEasy is using available?

I would like to be able to do something like:

ResourceMethodRegistry registry = ResourceMethodRegistryFactory.getInstance();
ResourceMethod otherMethod = (ResourceMethod) registry.getResourceInvoker(myRequest);

The reason I would like to do this is to be able to get call "signatures" that are calculated based on annotations for the method I am trying to resolve in order to invalidate caches.

Upvotes: 1

Views: 284

Answers (1)

eiden
eiden

Reputation: 2349

During deployment, the ResourceMethodRegistry is added to the ServletContext. So you should be able to get it by doing this:

ResourceMethodRegistry registry =
          (ResourceMethodRegistry)context.getAttribute(Registry.class.getName());

Upvotes: 1

Related Questions