public class GrizzlyConnectorProvider extends Object implements ConnectorProvider
connectors that utilize
Grizzly Asynchronous HTTP Client to send and receive HTTP request and responses.
The following connector configuration properties are supported:
ClientProperties.CONNECT_TIMEOUTClientProperties.READ_TIMEOUTClientProperties.REQUEST_ENTITY_PROCESSING
- default value is RequestEntityProcessing.CHUNKEDClientProperties.PROXY_URIClientProperties.PROXY_USERNAMEClientProperties.PROXY_PASSWORD
Connector instances created via this connector provider use
chunked encoding as a default setting.
This can be overridden by the ClientProperties.REQUEST_ENTITY_PROCESSING.
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.
| Modifier and Type | Class and Description |
|---|---|
static interface |
GrizzlyConnectorProvider.AsyncClientCustomizer
A customization SPI for the async client instance underlying Grizzly connectors.
|
static interface |
GrizzlyConnectorProvider.RequestCustomizer
A customization SPI for the async client request instances.
|
| Constructor and Description |
|---|
GrizzlyConnectorProvider()
Create new Grizzly Async HTTP Client connector provider.
|
GrizzlyConnectorProvider(GrizzlyConnectorProvider.AsyncClientCustomizer asyncClientCustomizer)
Create new Grizzly Async HTTP Client connector provider with a custom client configuration customizer.
|
| Modifier and Type | Method and Description |
|---|---|
Connector |
getConnector(Client client,
Configuration config)
Get a Jersey client connector instance for a given
client instance
and Jersey client runtime configuration. |
static com.ning.http.client.AsyncHttpClient |
getHttpClient(Configurable<?> component)
Retrieve the underlying Grizzly
AsyncHttpClient instance from
JerseyClient or JerseyWebTarget
configured to use GrizzlyConnectorProvider. |
static ClientConfig |
register(ClientConfig config,
GrizzlyConnectorProvider.RequestCustomizer customizer)
Register a request customizer for a all requests executed by a client instance configured with this client config.
|
static Invocation.Builder |
register(Invocation.Builder builder,
GrizzlyConnectorProvider.RequestCustomizer customizer)
Register a request customizer for a single request.
|
public GrizzlyConnectorProvider()
public GrizzlyConnectorProvider(GrizzlyConnectorProvider.AsyncClientCustomizer asyncClientCustomizer)
asyncClientCustomizer - Async HTTP Client configuration customizer.public Connector getConnector(Client client, Configuration config)
ConnectorProviderclient instance
and Jersey client runtime configuration.
Note that the supplied runtime configuration can be different from the client instance
configuration as a single client can be used to serve multiple differently configured runtimes.
While the SSL context or hostname verifier
are shared, other configuration properties may change in each runtime.
Based on the supplied client and runtime configuration data, it is up to each connector provider implementation to decide whether a new dedicated connector instance is required or if the existing, previously create connector instance can be reused.
getConnector in interface ConnectorProviderclient - Jersey client instance.config - Jersey client runtime configuration.Connector instance to be used by the client.public static com.ning.http.client.AsyncHttpClient getHttpClient(Configurable<?> component)
AsyncHttpClient instance from
JerseyClient or JerseyWebTarget
configured to use GrizzlyConnectorProvider.component - JerseyClient or JerseyWebTarget instance that is configured to use
GrizzlyConnectorProvider.AsyncHttpClient instance.IllegalArgumentException - in case the component is neither JerseyClient
nor JerseyWebTarget instance or in case the component
is not configured to use a GrizzlyConnectorProvider.public static Invocation.Builder register(Invocation.Builder builder, GrizzlyConnectorProvider.RequestCustomizer customizer)
Invoking this method on an instance that is not configured to use Grizzly Async HTTP Client connector does not have any effect.
builder - JAX-RS request invocation builder.customizer - request customizer to be registered.GrizzlyConnectorProvider.RequestCustomizer attached.public static ClientConfig register(ClientConfig config, GrizzlyConnectorProvider.RequestCustomizer customizer)
Invoking this method on an instance that is not configured to use Grizzly Async HTTP Client connector does not have any effect.
config - Jersey client configuration.customizer - Async HTTP Client configuration customizer.RequestCustomizer attached.Copyright © 2007-2014, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.