You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "KARR, DAVID" <dk...@att.com> on 2017/03/09 20:00:03 UTC

Call "ClientBuilder.newBuilder().newClient()" or "ClientBuilder.newClient()"?

At http://cxf.apache.org/docs/jax-rs-client-api.html#JAX-RSClientAPI-JAX-RS2.0ClientAPI I saw the following code sample:
-------------
Client client = ClientBuilder.newBuilder().newClient();
WebTarget target = client.target("http://localhost:8080/rs");
target = target.path("service").queryParam("a", "avalue");
 
Invocation.Builder builder = target.request();
Response response = builder.get();
Book book = builder.get(Book.class);
-------------

When I looked at the JAX-RS 2.0 javadoc, I noticed that ClientBuilder has both a "newBuilder()" method and a "newClient()" method.

Can someone elaborate on this?

Re: Call "ClientBuilder.newBuilder().newClient()" or "ClientBuilder.newClient()"?

Posted by Sergey Beryozkin <sb...@gmail.com>.
Starting with the newBuilder is more flexible, you can add SSL 
configuration, etc

Cheers, Sergey
On 09/03/17 20:00, KARR, DAVID wrote:
> At http://cxf.apache.org/docs/jax-rs-client-api.html#JAX-RSClientAPI-JAX-RS2.0ClientAPI I saw the following code sample:
> -------------
> Client client = ClientBuilder.newBuilder().newClient();
> WebTarget target = client.target("http://localhost:8080/rs");
> target = target.path("service").queryParam("a", "avalue");
>
> Invocation.Builder builder = target.request();
> Response response = builder.get();
> Book book = builder.get(Book.class);
> -------------
>
> When I looked at the JAX-RS 2.0 javadoc, I noticed that ClientBuilder has both a "newBuilder()" method and a "newClient()" method.
>
> Can someone elaborate on this?
>


-- 
Sergey Beryozkin

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