public class ApacheConnector extends Object implements Connector
Connector 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:
ApacheClientProperties.CONNECTION_MANAGERApacheClientProperties.HTTP_PARAMSApacheClientProperties.CREDENTIALS_PROVIDERApacheClientProperties.DISABLE_COOKIESApacheClientProperties.PROXY_URIApacheClientProperties.PROXY_USERNAMEApacheClientProperties.PROXY_PASSWORDApacheClientProperties.PREEMPTIVE_BASIC_AUTHENTICATIONApacheClientProperties.SSL_CONFIGClientProperties.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
ApacheClientProperties.PREEMPTIVE_BASIC_AUTHENTICATION must
be set to true.
If a ClientResponse is obtained and an
entity is not read from the response then
InboundMessageContext.close() MUST be called
after processing the response to release connection-based resources.
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.
The following methods are currently supported: HEAD, GET, POST, PUT, DELETE and OPTIONS.ApacheClientProperties.CONNECTION_MANAGER| Constructor and Description |
|---|
ApacheConnector(javax.ws.rs.core.Configuration config)
Create the new Apache HTTP Client connector.
|
| Modifier and Type | Method and Description |
|---|---|
ClientResponse |
apply(ClientRequest clientRequest) |
Future<?> |
apply(ClientRequest request,
AsyncConnectorCallback callback) |
void |
close() |
org.apache.http.client.CookieStore |
getCookieStore()
Get the
CookieStore. |
org.apache.http.client.HttpClient |
getHttpClient()
Get the
HttpClient. |
String |
getName() |
public ApacheConnector(javax.ws.rs.core.Configuration config)
config - client configuration.public org.apache.http.client.HttpClient getHttpClient()
HttpClient.HttpClient.public org.apache.http.client.CookieStore getCookieStore()
CookieStore.CookieStore instance or null when set to
true.public ClientResponse apply(ClientRequest clientRequest) throws javax.ws.rs.ProcessingException
apply in interface Connectorapply in interface Inflector<ClientRequest,ClientResponse>javax.ws.rs.ProcessingExceptionpublic Future<?> apply(ClientRequest request, AsyncConnectorCallback callback)
Copyright © 2007-2013, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.