Hi
On 17/02/15 10:00, David Karlsen wrote:
Hi.

We're going (gradually) from a CXF based JAX-WS world to a CXF based JAX-RS
world.
What is really good about CXF is that it can support combining both worlds and migrating between the two well.
I have a number of Interceptors to do some custom stuff, and I'd like to
keep the same implementation serving both scenarios.

Is it possible to get either a ContainerRequestContext (preferrably) or a
MessageContext from the Message object available in the interceptor?

I want to work on these types of objects as they are JAX-RS types and it
wold ease/secure my transition on to pure JAX-RS Filters later on.

I'm aware that I can inject the MessageContext into the interceptor, but it
would defeat the purpose somewhat/be less intrusive for users of the
interceptor if I can just create it behind the scenes.
So you'd like to have ContainerRequestContext available inside CXF interceptors ?

new ContainerRequestContextImpl( message, false, false )

seems a little hackish, and I'm not entirely sure what the booleans control.

The 1st boolean indicates if this context will be passed to a pre-match or post-match ContainerRequestFilter. In a pre match mode the filters can use the context to update the request URI, media types, and other properties that can affect the matching process. Hence the exception is expected if such properties are modified in a post-match mode.

The 2nd boolean indicates if this context will be passed to ContainerResponseFilter (which accepts both request and response contexts) or not. Again, the context will throw the exception if it is modified as part of the outbound chain.

Does it help ?

Cheers, Sergey


Reply via email to