public interface Client extends Configurable<Client>, java.lang.AutoCloseable
Client is the main entry point to the fluent API used to build and execute client requests in order to consume responses returned.
Clients are heavy-weight objects that manage the client-side communication infrastructure. Initialization as well as disposal of aClient
instance may be a rather expensive operation. It is therefore advised to construct only
a small number of Client
instances in the application. Client instances must be properly
closed
before being disposed to avoid leaking resources.Configurable
Modifier and Type | Method and Description |
---|---|
void |
close()
Close client instance and all it's associated resources.
|
javax.net.ssl.HostnameVerifier |
getHostnameVerifier()
Get the hostname verifier configured in the client or
null in case no hostname verifier has been configured. |
javax.net.ssl.SSLContext |
getSslContext()
Get the SSL context configured to be used with the current client run-time.
|
Invocation.Builder |
invocation(Link link)
Build an invocation builder from a link.
|
WebTarget |
target(Link link)
Build a new web resource target.
|
WebTarget |
target(java.lang.String uri)
Build a new web resource target.
|
WebTarget |
target(java.net.URI uri)
Build a new web resource target.
|
WebTarget |
target(UriBuilder uriBuilder)
Build a new web resource target.
|
void close()
Close client instance and all it's associated resources. Subsequent calls have no effect and are ignored. Once the
client is closed, invoking any other method on the client instance would result in an IllegalStateException
being thrown.
resource targets
produced by the client instance.
Invoking any method on such targets once the client is closed would result in an IllegalStateException
being
thrown.close
in interface java.lang.AutoCloseable
WebTarget target(java.lang.String uri)
uri
- web resource URI. May contain template parameters. Must not be null
.java.lang.IllegalArgumentException
- in case the supplied string is not a valid URI template.java.lang.NullPointerException
- in case the supplied argument is null
.WebTarget target(java.net.URI uri)
uri
- web resource URI. Must not be null
.java.lang.NullPointerException
- in case the supplied argument is null
.WebTarget target(UriBuilder uriBuilder)
uriBuilder
- web resource URI represented as URI builder. Must not be null
.java.lang.NullPointerException
- in case the supplied argument is null
.WebTarget target(Link link)
link
- link to a web resource. Must not be null
.java.lang.NullPointerException
- in case the supplied argument is null
.Invocation.Builder invocation(Link link)
Build an invocation builder from a link. It uses the URI and the type of the link to initialize the invocation builder. The type is used as the initial value for the HTTP Accept header, if present.
link
- link to build invocation from. Must not be null
.java.lang.NullPointerException
- in case link is null
.javax.net.ssl.SSLContext getSslContext()
javax.net.ssl.HostnameVerifier getHostnameVerifier()
null
in case no hostname verifier has been configured.null
if not set.