public class ApacheHttpClient4
extends com.sun.jersey.api.client.Client
Client
that utilizes the Apache HTTP Client to send and receive
HTTP request and responses.
The following properties are only supported at construction of this class:
ApacheHttpClient4Config.PROPERTY_CONNECTION_MANAGER
ApacheHttpClient4Config.PROPERTY_HTTP_PARAMS
}
ApacheHttpClient4Config.PROPERTY_CREDENTIALS_PROVIDER
}
ApacheHttpClient4Config.PROPERTY_DISABLE_COOKIES
}
ApacheHttpClient4Config.PROPERTY_PROXY_URI
}
ApacheHttpClient4Config.PROPERTY_PROXY_USERNAME
}
ApacheHttpClient4Config.PROPERTY_PROXY_PASSWORD
}
ApacheHttpClient4Config.PROPERTY_PREEMPTIVE_BASIC_AUTHENTICATION
}
The default behaviour of the client is different than what it described in the
the property ClientConfig.PROPERTY_CHUNKED_ENCODING_SIZE
. By default, the apache client
uses chunked encoding to write the entity. In order to buffer the entity the property
ApacheHttpClient4Config.PROPERTY_ENABLE_BUFFERING
must be set to true.
Using of authorization is dependent on the chunk encoding setting. If the entity
buffering is enabled, the entity is buffered and authorization can be performed
automatically in response to a 401 by sending the request again. When entity buffering
is disabled (chunked encoding is used) then the property
ApacheHttpClient4Config.PROPERTY_PREEMPTIVE_BASIC_AUTHENTICATION
must
be set to true
.
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.ApacheHttpClient4Config.PROPERTY_CONNECTION_MANAGER
Constructor and Description |
---|
ApacheHttpClient4()
Create a new client instance.
|
ApacheHttpClient4(ApacheHttpClient4Handler root)
Create a new client instance.
|
ApacheHttpClient4(ApacheHttpClient4Handler root,
com.sun.jersey.api.client.config.ClientConfig config)
Create a new client instance with a client configuration.
|
ApacheHttpClient4(ApacheHttpClient4Handler root,
com.sun.jersey.api.client.config.ClientConfig config,
com.sun.jersey.core.spi.component.ioc.IoCComponentProviderFactory provider)
Create a new instance with a client configuration and a
component provider.
|
Modifier and Type | Method and Description |
---|---|
static ApacheHttpClient4 |
create()
Create a default client.
|
static ApacheHttpClient4 |
create(com.sun.jersey.api.client.config.ClientConfig cc)
Create a default client with client configuration.
|
static ApacheHttpClient4 |
create(com.sun.jersey.api.client.config.ClientConfig cc,
com.sun.jersey.core.spi.component.ioc.IoCComponentProviderFactory provider)
Create a default client with client configuration and component provider.
|
ApacheHttpClient4Handler |
getClientHandler()
Get the Apache HTTP client handler.
|
asyncResource, asyncResource, asyncView, asyncView, asyncView, asyncView, asyncViewResource, asyncViewResource, destroy, finalize, getExecutorService, getMessageBodyWorkers, getProperties, getProviders, getViewProxy, handle, inject, resource, resource, setChunkedEncodingSize, setConnectTimeout, setExecutorService, setFollowRedirects, setReadTimeout, view, view, view, view, view, view, viewResource, viewResource
public ApacheHttpClient4()
public ApacheHttpClient4(ApacheHttpClient4Handler root)
root
- the root client handler for dispatching a request and
returning a response.public ApacheHttpClient4(ApacheHttpClient4Handler root, com.sun.jersey.api.client.config.ClientConfig config)
root
- the root client handler for dispatching a request and
returning a response.config
- the client configuration.public ApacheHttpClient4(ApacheHttpClient4Handler root, com.sun.jersey.api.client.config.ClientConfig config, com.sun.jersey.core.spi.component.ioc.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.public ApacheHttpClient4Handler getClientHandler()
public static ApacheHttpClient4 create()
public static ApacheHttpClient4 create(com.sun.jersey.api.client.config.ClientConfig cc)
cc
- the client configuration.public static ApacheHttpClient4 create(com.sun.jersey.api.client.config.ClientConfig cc, com.sun.jersey.core.spi.component.ioc.IoCComponentProviderFactory provider)
cc
- the client configuration.provider
- the IoC component provider factory.Copyright © 2014. All Rights Reserved.