I am looking for a mechanism in JAX-RS (JSR-311) to resolve some of my cross-cutting issues specific to my application. For example, my application has a specific context that is viewed or created for each request. I would like this type of logic to be executed in a centralized place, and then somehow tied to a context that will be used by various resources for the rest of the request. It would be even better if I could perform these types of actions only on some subsets of URLs.
The default injection that JAX-RS provides for path segments, cookies, headers, etc. is great, but what about a user-defined interpretation of these parts? I really do not want to build, every time I need it. I would prefer to indicate how it is built, and then just include the context component as part of my resource method.
Do such hooks exist? Can I manipulate a supplier model to do this? BTW, I want to remain implementation independent (Jersey, RESTEasy, etc.) for as long as possible.
Thanks in advance for your understanding.
source
share