Top Description Methods
javax.ws.rs.client

public Interface Client

extends Configurable<Client>
Imports
java.net.URI, javax.ws.rs.core.Configurable, .Link, .UriBuilder, javax.net.ssl.HostnameVerifier, .SSLContext

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 a Client 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.

Author
Marek Potociar
Since
2.0
See Also
javax.ws.rs.core.Configurable

Method Summary

Modifier and TypeMethod and Description
public void
close()

Close client instance and all it's associated resources.

public HostnameVerifier

Returns:

client hostname verifier or null if not set.
getHostnameVerifier
()

Get the hostname verifier configured in the client or null in case no hostname verifier has been configured.

public SSLContext

Returns:

SSL context configured to be used with the current client run-time.
getSslContext
()

Get the SSL context configured to be used with the current client run-time.

public WebTarget

Returns:

web resource target bound to the provided URI.
target
(String
web resource URI. May contain template parameters. Must not be null.
uri
)

Build a new web resource target.

public WebTarget

Returns:

web resource target bound to the provided URI.
target
(URI
web resource URI. Must not be null.
uri
)

Build a new web resource target.

public WebTarget

Returns:

web resource target bound to the provided URI.
target
(UriBuilder
web resource URI represented as URI builder. Must not be null.
uriBuilder
)

Build a new web resource target.

Inherited from javax.ws.rs.core.Configurable:
getConfigurationpropertyregisterregisterregisterregisterregisterregisterregisterregister

Method Detail

closeback to summary
public 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.

Calling this method effectively invalidates all 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.

getHostnameVerifierback to summary
public HostnameVerifier getHostnameVerifier()

Get the hostname verifier configured in the client or null in case no hostname verifier has been configured.

Returns:HostnameVerifier

client hostname verifier or null if not set.

getSslContextback to summary
public SSLContext getSslContext()

Get the SSL context configured to be used with the current client run-time.

Returns:SSLContext

SSL context configured to be used with the current client run-time.

targetback to summary
public WebTarget target(String uri)

Build a new web resource target.

Parameters
uri:String

web resource URI. May contain template parameters. Must not be null.

Returns:WebTarget

web resource target bound to the provided URI.

Exceptions
IllegalArgumentException:
in case the supplied string is not a valid URI template.
NullPointerException:
in case the supplied argument is null.
targetback to summary
public WebTarget target(URI uri)

Build a new web resource target.

Parameters
uri:URI

web resource URI. Must not be null.

Returns:WebTarget

web resource target bound to the provided URI.

Exceptions
NullPointerException:
in case the supplied argument is null.
targetback to summary
public WebTarget target(UriBuilder uriBuilder)

Build a new web resource target.

Parameters
uriBuilder:UriBuilder

web resource URI represented as URI builder. Must not be null.

Returns:WebTarget

web resource target bound to the provided URI.

Exceptions
NullPointerException:
in case the supplied argument is null.