public final class ApacheHttpClient4Handler
extends com.sun.jersey.api.client.TerminatingClientHandler
Client operations are thread safe, the HTTP connection may be shared between different threads.
If a response entity is obtained that is an instance of Closeable
then the instance MUST be closed after processing the entity to release
connection-based resources.
If a ClientResponse
is obtained and an entity is not read from the
response then ClientResponse.close()
MUST be called after processing
the response to release connection-based resources.
The following methods are currently supported: HEAD, GET, POST, PUT, DELETE and OPTIONS.
Chunked transfer encoding can be enabled or disabled but configuration of
the chunked encoding size is not possible. If the
ClientConfig.PROPERTY_CHUNKED_ENCODING_SIZE
property is set
to a non-null value then chunked transfer encoding is enabled.
Constructor and Description |
---|
ApacheHttpClient4Handler(org.apache.http.client.HttpClient client,
org.apache.http.client.CookieStore cookieStore,
boolean preemptiveBasicAuth)
Create a new root handler with an
HttpClient . |
Modifier and Type | Method and Description |
---|---|
org.apache.http.client.CookieStore |
getCookieStore()
Get the
CookieStore . |
org.apache.http.client.HttpClient |
getHttpClient()
Get the
HttpClient . |
com.sun.jersey.api.client.ClientResponse |
handle(com.sun.jersey.api.client.ClientRequest cr) |
public ApacheHttpClient4Handler(org.apache.http.client.HttpClient client, org.apache.http.client.CookieStore cookieStore, boolean preemptiveBasicAuth)
HttpClient
.client
- the HttpClient
.cookieStore
- CookieStore
instancepreemptiveBasicAuth
- turns on preemptive basic authenticationpublic org.apache.http.client.HttpClient getHttpClient()
HttpClient
.HttpClient
.public org.apache.http.client.CookieStore getCookieStore()
CookieStore
.CookieStore
instance or null when
ApacheHttpClient4Config.PROPERTY_DISABLE_COOKIES set to true.public com.sun.jersey.api.client.ClientResponse handle(com.sun.jersey.api.client.ClientRequest cr) throws com.sun.jersey.api.client.ClientHandlerException
com.sun.jersey.api.client.ClientHandlerException
Copyright © 2014. All Rights Reserved.