Hi It is not possible to register CXF specific Feature or Interceptor with JAX-RS 2.0 Client API.
When you do "client.register(new MyLoggingFeature())", assuming it is CXF Feature, then it will be currently ignored.
I wonder if it might make sense to create some JAX-RS 2.0 FeatureWrapper which can wrap an arbitrary CXF Feature...I'll try to experiment with it...
Sergey On 22/03/16 01:56, Eirik Bjørsnøs wrote:
Hello, Is the CXF implementation of the JAX-RS 2.0 client API designed to allow Interceptors to be configured on Clients? If so, how should this be done? Say we have a Client built like this: Client client = ClientBuilder.newClient(); and we want to configure Logging[In/Out]Interceptors of this client. (Just as an example). First I tried in various ways to get an Endpoint out of the client, but failed at that. Then, after looking through the implementation classes of Client/WebTarget, I discovered that you can register CXF Features on a Client using something like client.register(new MyLoggingFeature()); However, with this setup MyLoggingFeature.initialize(InterceptorProvider ip, Bus bus) is called _once per request_. Not exactly what I wanted since it lead to the interceptor chains being filled up with duplicate LoggingInterceptors. I might perhaps have misunderstood the lifecycle of Clients and/or WebTargets. Should be ok to reuse a JAX-RS 2.0 Client, right? Can someone please enlighten me? Did I perhaps miss some relevant documentation? Cheers, Eirik.