-
- All Superinterfaces:
- Configurable<Client>
public interface Client extends Configurable<Client>
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 ofClient
instances in the application. Client instances must beproperly closed
before being disposed to avoid leaking resources.- Since:
- 2.0
- Author:
- Marek Potociar
- See Also:
Configurable
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description void
close()
Close client instance and all it's associated resources.HostnameVerifier
getHostnameVerifier()
Get the hostname verifier configured in the client ornull
in case no hostname verifier has been configured.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(String uri)
Build a new web resource target.WebTarget
target(URI uri)
Build a new web resource target.WebTarget
target(UriBuilder uriBuilder)
Build a new web resource target.
-
-
-
Method Detail
-
close
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 anIllegalStateException
being thrown. Calling this method effectively invalidates allresource targets
produced by the client instance. Invoking any method on such targets once the client is closed would result in anIllegalStateException
being thrown.
-
target
WebTarget target(String uri)
Build a new web resource target.- Parameters:
uri
- web resource URI. May contain template parameters. Must not benull
.- Returns:
- web resource target bound to the provided URI.
- Throws:
IllegalArgumentException
- in case the supplied string is not a valid URI template.NullPointerException
- in case the supplied argument isnull
.
-
target
WebTarget target(URI uri)
Build a new web resource target.- Parameters:
uri
- web resource URI. Must not benull
.- Returns:
- web resource target bound to the provided URI.
- Throws:
NullPointerException
- in case the supplied argument isnull
.
-
target
WebTarget target(UriBuilder uriBuilder)
Build a new web resource target.- Parameters:
uriBuilder
- web resource URI represented as URI builder. Must not benull
.- Returns:
- web resource target bound to the provided URI.
- Throws:
NullPointerException
- in case the supplied argument isnull
.
-
target
WebTarget target(Link link)
Build a new web resource target.- Parameters:
link
- link to a web resource. Must not benull
.- Returns:
- web resource target bound to the linked web resource.
- Throws:
NullPointerException
- in case the supplied argument isnull
.
-
invocation
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.
- Parameters:
link
- link to build invocation from. Must not benull
.- Returns:
- newly created invocation builder.
- Throws:
NullPointerException
- in case link isnull
.
-
getSslContext
SSLContext getSslContext()
Get the SSL context configured to be used with the current client run-time.- Returns:
- SSL context configured to be used with the current client run-time.
-
getHostnameVerifier
HostnameVerifier getHostnameVerifier()
Get the hostname verifier configured in the client ornull
in case no hostname verifier has been configured.- Returns:
- client hostname verifier or
null
if not set.
-
-
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 11/06/2005 gemaakt, de laatste keer de 18/08/2025 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-javaee-rf-javax/ws/rs/client/Client.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur van deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.