I'm looking for a mechanism within JAX-RS (JSR-311) to allow me to distill out some of my cross-cutting concerns specific to my app. For example, my app has certain context which is looked up or built for each request. I'd like to be able to have this type of logic be performed in a centralized location and then somehow be attached to the context to be utilized by various resources for the remainder of the request. It would be even better if I could perform these types of actions for only some subsets of URLs.
The default injection that JAX-RS provides for path segments, cookie, header, etc. is great but what about custom interpretation of those parts? I really don't want to have to build that each time I need it. I'd rather have a way to specify how it is built and then just have the context component injected as part of my resource method.
Do any such hooks exist? Can I manipulate the providers model to do this? BTW, I want to stay implementation independent (Jersey, RESTEasy, etc.) as long as possible.
Thanks in advance for any insight.