org.glassfish.jersey.apache.connector
Class ApacheConnectorProvider

java.lang.Object
  extended by org.glassfish.jersey.apache.connector.ApacheConnectorProvider
All Implemented Interfaces:
ConnectorProvider

public class ApacheConnectorProvider
extends Object
implements ConnectorProvider

Connector provider for Jersey connectors that utilize Apache HTTP Client to send and receive HTTP request and responses.

The following connector configuration properties are supported:

Connector instances created via this connector provider use chunked encoding as a default setting. This can be overridden by the ClientProperties.REQUEST_ENTITY_PROCESSING. By default the ClientProperties.CHUNKED_ENCODING_SIZE property is only supported when using the default org.apache.http.conn.HttpClientConnectionManager instance. If custom connection manager is used, then chunked encoding size can be set by providing a custom org.apache.http.HttpClientConnection (via custom org.apache.http.impl.conn.ManagedHttpClientConnectionFactory) and overriding it's createOutputStream method.

Use of authorization by the AHC-based connectors 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 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.

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, OPTIONS, PATCH and TRACE.

Since:
2.5
Author:
Pavel Bucek (pavel.bucek at oracle.com), Arul Dhesiaseelan (aruld at acm.org), jorgeluisw at mac.com, Marek Potociar (marek.potociar at oracle.com), Paul Sandoz (paul.sandoz at oracle.com)

Constructor Summary
ApacheConnectorProvider()
           
 
Method Summary
 Connector getConnector(javax.ws.rs.client.Client client, javax.ws.rs.core.Configuration runtimeConfig)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ApacheConnectorProvider

public ApacheConnectorProvider()
Method Detail

getConnector

public Connector getConnector(javax.ws.rs.client.Client client,
                              javax.ws.rs.core.Configuration runtimeConfig)
Specified by:
getConnector in interface ConnectorProvider


Copyright © 2007-2014, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.