public class JettyConnectorProvider extends Object implements ConnectorProvider
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.SSL_CONFIGJettyClientProperties.PREEMPTIVE_BASIC_AUTHENTICATIONJettyClientProperties.DISABLE_COOKIESThis 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.
| Constructor and Description |
|---|
JettyConnectorProvider() |
| Modifier and Type | Method and Description |
|---|---|
Connector |
getConnector(javax.ws.rs.client.Client client,
javax.ws.rs.core.Configuration runtimeConfig) |
public Connector getConnector(javax.ws.rs.client.Client client, javax.ws.rs.core.Configuration runtimeConfig)
getConnector in interface ConnectorProviderCopyright © 2007-2014, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.