Hi
On 02/02/12 17:25, hdave wrote:

Sergey Beryozkin-5 wrote

It is, I'm on it...
At the moment the workaround is to register a single ContextResolver
which will have "@Context HttpHeaders" injected. In its getContext()
method it would check the first element in
httpHeaders.getAcceptableTypes() and will delegate to the appropriate
internal ContextResolverImpl, a bit messy, but should work as a temp
solution


Learn something new every day!  Thanks for the work-around, that'll work
well for the interim.

One thing which you may need to to check is whether it is an in or out message. If it's the in one then httpHeaders.getMediaType() (= Content-Type) that will have to act as a selector, otherwise the top/first Accept value

Message m = PhaseInterceptorChain.getCurrentMessage();

if (m.getEchange().getOutMessage() == m) {
    // out
    httpHeaders.getAcceptableTypes()

} else {
    // in
    httpHeaders.getMediaType()
}
That will be hidden of course after the fix, but for now this is something that has to be done in the custom ContextResolver unless you only deal with GETs

Cheers, Sergey

--
View this message in context: 
http://cxf.547215.n5.nabble.com/Issue-with-JAX-RS-providers-getContextResolver-tp5451093p5451378.html
Sent from the cxf-user mailing list archive at Nabble.com.


--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Reply via email to