On 23/05/12 14:14, ceineke wrote:

Sergey Beryozkin-5 wrote

The best way to get a UriInfo ref injected into a Mapper instance is to
do mapper.setUriInfo(uriInfo) from within Service.setUriInfo method. I
believe that by the time Service.setUriInfo is called the Service
instance has been completely initialized by Spring

Definitely not the cleanest solution, but I'll take that offer for now. :-)

I guess I can agree that having an application (Service) UriInfo setter having one extra call, mapper.setUriInfo() looks like an extra effort to be made, but at the same time I see it as a simple and effective solution: Mapper does not have to implement an extra interface, not @Context annotations and it just works.


Could I write a request listener that autowire's a list of beans that
implement UriInfoInjectable and do the injection myself?

I do not know. Perhaps the SpringResourceFactory class may offer some extension hooks, but the question is also how the runtime can know which (thread-local) contexts it can offer to the 'interested' listener.

In principle we can probably introduce some ContextListener interface that will be registered with a given jaxrs:server endpoint and the runtime will ask it to return a Class array or list such as UriInfo.class, HttpHeaders.class, etc, and it is completely up to such ContextListener implementation to find out which contexts may be needed.
After that the runtime will pass the relevant context proxies to it.

Cheers, Sergey


--
View this message in context: 
http://cxf.547215.n5.nabble.com/UriInfo-is-not-injected-tp5707988p5708382.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to