You can do so for injected Client
/WebTarget
, take a look at Managed JAX-RS Client article to find out how. Injected WebTarget
looks like:
@Path("resource")
public class MyResource {
@Uri("http://example.com")
private WebTarget target;
@GET
public String sayHello() {
return target.request().get(String.class);
}
}
Otherwise, if you want to create a client instance yourself you can only use configuration of the JAX-RS application (so no really custom configuration):
@Path("resource")
public class MyResource {
@Context
private Configuration config;
@GET
public String sayHello() {
return ClientBuilder
.newBuilder()
.withConfig(config)
.target("http://example.com")
.request().get(String.class);
}
}
Note: In this use-case your client will have all the applicable configuration you server-side has.