You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Benson Margulies <bi...@gmail.com> on 2014/11/10 13:23:45 UTC

JAX-RS 2.0 Client vs. CXF config

I've lost the email this should reply to ...

Based in email from Sergey, I thought I could do ...

ClientBuilder builder = ClientBuilder.newBuilder();
...
Client client = builder.build();
WebTarget target = client.target(...);
...

ClientConfiguration cxfConfig = WebClient.getConfig(target);

but I find that I cannot; the WebTarget object has a null CXF client
object in it, so this throws.

Is there a path?

Re: JAX-RS 2.0 Client vs. CXF config

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 10/11/14 12:23, Benson Margulies wrote:
> I've lost the email this should reply to ...
>
> Based in email from Sergey, I thought I could do ...
>
> ClientBuilder builder = ClientBuilder.newBuilder();
> ...
> Client client = builder.build();
> WebTarget target = client.target(...);
> ...
>
> ClientConfiguration cxfConfig = WebClient.getConfig(target);
>
> but I find that I cannot; the WebTarget object has a null CXF client
> object in it, so this throws.
Right, client.target() is not guaranteed to have a WebTarget with an 
final URI (it can have templates there) so the internal WebClient is 
initialized only after one of WebTarget's request() methods is called.
It is fine from the 2.0 API point of view, but can be somewhat 
unexpected if a piece of the CXF specific code is injected :-)
>
> Is there a path?
Yes, do
Invocation.Builder builder = webTarget.request(...);
WebClient.getConfig(builder);

Cheers, Sergey
>