|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.jersey.api.client.filter.Filterable
com.sun.jersey.api.client.Client
com.sun.jersey.client.apache.ApacheHttpClient
public class ApacheHttpClient
A Client
that utilizes the Apache HTTP client to send and receive
HTTP request and responses.
If an ApacheHttpClientHandler
is not explicitly passed as a
constructor or method parameter then by default an instance is created with
an HttpClient
constructed with a MultiThreadedHttpConnectionManager
instance.
The following properties are only supported at construction of this class:
ApacheHttpClientConfig.PROPERTY_PREEMPTIVE_AUTHENTICATION
and
ClientConfig.PROPERTY_CONNECT_TIMEOUT
.
By default a request entity is buffered and repeatable such that authorization may be performed automatically in response to a 401 response.
If the property ClientConfig.PROPERTY_CHUNKED_ENCODING_SIZE
size
is set to a value greater than 0 then chunked encoding will be enabled
and the request entity (if present) will not be buffered and is not
repeatable. For authorization to work in such scenarios the property
ApacheHttpClientConfig.PROPERTY_PREEMPTIVE_AUTHENTICATION
must
be set to true.
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.
Constructor Summary | |
---|---|
ApacheHttpClient()
Create a new client instance. |
|
ApacheHttpClient(ApacheHttpClientHandler root)
Create a new client instance. |
|
ApacheHttpClient(ApacheHttpClientHandler root,
ClientConfig config)
Create a new client instance with a client configuration. |
|
ApacheHttpClient(ApacheHttpClientHandler root,
ClientConfig config,
IoCComponentProviderFactory provider)
Create a new instance with a client configuration and a component provider. |
Method Summary | |
---|---|
static ApacheHttpClient |
create()
Create a default client. |
static ApacheHttpClient |
create(ClientConfig cc)
Create a default client with client configuration. |
static ApacheHttpClient |
create(ClientConfig cc,
IoCComponentProviderFactory provider)
Create a default client with client configuration and component provider. |
ApacheHttpClientHandler |
getClientHandler()
Get the Apache HTTP client handler. |
Methods inherited from class com.sun.jersey.api.client.Client |
---|
asyncResource, asyncResource, asyncView, asyncView, asyncView, asyncView, asyncViewResource, asyncViewResource, destroy, finalize, getExecutorService, getProperties, getProviders, getViewProxy, handle, resource, resource, setChunkedEncodingSize, setConnectTimeout, setExecutorService, setFollowRedirects, setReadTimeout, view, view, view, view, view, view, viewResource, viewResource |
Methods inherited from class com.sun.jersey.api.client.filter.Filterable |
---|
addFilter, getHeadHandler, isFilterPreset, removeAllFilters, removeFilter |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ApacheHttpClient()
public ApacheHttpClient(ApacheHttpClientHandler root)
root
- the root client handler for dispatching a request and
returning a response.public ApacheHttpClient(ApacheHttpClientHandler root, ClientConfig config)
root
- the root client handler for dispatching a request and
returning a response.config
- the client configuration.public ApacheHttpClient(ApacheHttpClientHandler root, ClientConfig config, IoCComponentProviderFactory provider)
root
- the root client handler for dispatching a request and
returning a response.config
- the client configuration.provider
- the IoC component provider factory.Method Detail |
---|
public ApacheHttpClientHandler getClientHandler()
public static ApacheHttpClient create()
public static ApacheHttpClient create(ClientConfig cc)
cc
- the client configuration.
public static ApacheHttpClient create(ClientConfig cc, IoCComponentProviderFactory provider)
cc
- the client configuration.provider
- the IoC component provider factory.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |