Class JettyConnectorProvider
java.lang.Object
org.glassfish.jersey.jetty.connector.JettyConnectorProvider
- All Implemented Interfaces:
ConnectorProvider
A
ConnectorProvider for Jersey connector
instances that utilize the Jetty HTTP Client to send and receive
HTTP request and responses.
The following connector configuration properties are supported:
ClientProperties.ASYNC_THREADPOOL_SIZEClientProperties.CONNECT_TIMEOUTClientProperties.FOLLOW_REDIRECTSClientProperties.PROXY_URIClientProperties.PROXY_USERNAMEClientProperties.PROXY_PASSWORDClientProperties.PROXY_PASSWORDJettyClientProperties.DISABLE_COOKIES*
JettyClientProperties.ENABLE_SSL_HOSTNAME_VERIFICATIONJettyClientProperties.PREEMPTIVE_BASIC_AUTHENTICATIONJettyClientProperties.SYNC_LISTENER_RESPONSE_MAX_SIZE
This transport supports both synchronous and asynchronous processing of client requests. The following methods are supported: GET, POST, PUT, DELETE, HEAD, OPTIONS, TRACE, CONNECT and MOVE.
Typical usage:
ClientConfig config = new ClientConfig();
config.connectorProvider(new JettyConnectorProvider());
Client client = ClientBuilder.newClient(config);
// async request
WebTarget target = client.target("http://localhost:8080");
Future<Response> future = target.path("resource").request().async().get();
// wait for 3 seconds
Response response = future.get(3, TimeUnit.SECONDS);
String entity = response.readEntity(String.class);
client.close();
Connector instances created via Jetty HTTP Client-based connector provider support only
entity buffering.
Defining the property ClientProperties.REQUEST_ENTITY_PROCESSING has no
effect on Jetty HTTP Client-based connectors.
- Since:
- 2.5
- Author:
- Arul Dhesiaseelan (aruld at acm.org), Marek Potociar
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetConnector(Client client, Configuration runtimeConfig) static org.eclipse.jetty.client.HttpClientgetHttpClient(Configurable<?> component) Retrieve the underlying JettyHttpClientinstance fromJerseyClientorJerseyWebTargetconfigured to useJettyConnectorProvider.
-
Constructor Details
-
JettyConnectorProvider
public JettyConnectorProvider()
-
-
Method Details
-
getConnector
- Specified by:
getConnectorin interfaceConnectorProvider
-
getHttpClient
Retrieve the underlying JettyHttpClientinstance fromJerseyClientorJerseyWebTargetconfigured to useJettyConnectorProvider.- Parameters:
component-JerseyClientorJerseyWebTargetinstance that is configured to useJettyConnectorProvider.- Returns:
- underlying Jetty
HttpClientinstance. - Throws:
IllegalArgumentException- in case thecomponentis neitherJerseyClientnorJerseyWebTargetinstance or in case the component is not configured to use aJettyConnectorProvider.- Since:
- 2.8
-