public interface RestClientBuilder extends javax.ws.rs.core.Configurable<RestClientBuilder>
Invoking newBuilder()
is intended to always create a new instance,
not use a cached version.
The RestClientBuilder
is a Configurable
class as defined
by JAX-RS. This allows a user to register providers, implementation specific
configuration.
Implementations are expected to implement this class and provide the instance
via the mechanism in RestClientBuilderResolver.instance()
.
Modifier and Type | Method and Description |
---|---|
default RestClientBuilder |
baseUri(URI uri)
Specifies the base URI to be used when making requests.
|
RestClientBuilder |
baseUrl(URL url)
Specifies the base URL to be used when making requests.
|
<T> T |
build(Class<T> clazz)
Based on the configured RestClientBuilder, creates a new instance of the
given REST interface to invoke API calls against.
|
RestClientBuilder |
executorService(ExecutorService executor)
Specifies the
ExecutorService to use when invoking
asynchronous Rest Client interface methods. |
static RestClientBuilder |
newBuilder() |
static RestClientBuilder newBuilder()
RestClientBuilder baseUrl(URL url)
@Path("/api")
at the interface level and a
url
is given with
http://my-service:8080/service
then all REST calls will be
invoked with a url
of
http://my-service:8080/service/api
in addition to any
@Path
annotations included on the method.
Subsequent calls to this method will replace the previously specified
baseUri/baseUrl.url
- the base Url for the service.default RestClientBuilder baseUri(URI uri)
@Path("/api")
at the interface level and a
uri
is given with
http://my-service:8080/service
then all REST calls will be
invoked with a uri
of
http://my-service:8080/service/api
in addition to any
@Path
annotations included on the method.
Subsequent calls to this method will replace the previously specified
baseUri/baseUrl.uri
- the base URI for the service.IllegalArgumentException
- if the passed in URI is invalidRestClientBuilder executorService(ExecutorService executor)
ExecutorService
to use when invoking
asynchronous Rest Client interface methods. By default, the executor
service used is determined by the MP Rest Client implementation runtime.executor
- the executor service for the runtime to use when invoking
asynchronous Rest Client interface methods - must be non-null.IllegalArgumentException
- if the executor
parameter is
null.<T> T build(Class<T> clazz) throws IllegalStateException, RestClientDefinitionException
T
- the type of the interfaceclazz
- the interface that defines REST API methods for useIllegalStateException
- if not all pre-requisites are satisfied for
the builder, this exception may get thrown. For instance, if the base
URI/URL has not been set.RestClientDefinitionException
- if the passed-in interface class is
invalid.Copyright © 2017–2018 Eclipse MicroProfile. All rights reserved.