A {@link Connector} that utilizes the Apache HTTP Client to send and receiveHTTP request and responses.
The following properties are only supported at construction of this class:
- {@link ApacheClientProperties#CONNECTION_MANAGER}
- {@link ApacheClientProperties#REQUEST_CONFIG}
- {@link ApacheClientProperties#CREDENTIALS_PROVIDER}
- {@link ApacheClientProperties#DISABLE_COOKIES}
- {@link ClientProperties#PROXY_URI}
- {@link ClientProperties#PROXY_USERNAME}
- {@link ClientProperties#PROXY_PASSWORD}
- {@link ClientProperties#REQUEST_ENTITY_PROCESSING} - default value is {@link RequestEntityProcessing#CHUNKED}
- {@link ApacheClientProperties#PREEMPTIVE_BASIC_AUTHENTICATION}
- {@link ApacheClientProperties#SSL_CONFIG}
This connector uses {@link RequestEntityProcessing#CHUNKED chunked encoding} as a default setting. This canbe overridden by the {@link ClientProperties#REQUEST_ENTITY_PROCESSING}. By default the {@link ClientProperties#CHUNKED_ENCODING_SIZE} property is only supported by using default connection manager. If customconnection manager needs to be used then chunked encoding size can be set by providing a custom {@link org.apache.http.HttpClientConnection} (via custom {@link org.apache.http.impl.conn.ManagedHttpClientConnectionFactory}) and overriding {@code createOutputStream} method.
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 {@link org.glassfish.jersey.apache.connector.ApacheClientProperties#PREEMPTIVE_BASIC_AUTHENTICATION} mustbe set to {@code true}.
If a {@link org.glassfish.jersey.client.ClientResponse} is obtained and anentity is not read from the response then {@link org.glassfish.jersey.client.ClientResponse#close()} MUST be calledafter 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 {@link 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.
@author jorgeluisw@mac.com
@author Paul Sandoz (paul.sandoz at oracle.com)
@author Pavel Bucek (pavel.bucek at oracle.com)
@author Arul Dhesiaseelan (aruld at acm.org)
@see ApacheClientProperties#CONNECTION_MANAGER