public class DropwizardApacheConnector extends Object implements org.glassfish.jersey.client.spi.Connector
It's a custom version of Jersey's Connector
that uses Apache's HttpClient
as an HTTP transport implementation.
It uses a pre-configured HTTP client by HttpClientBuilder
rather then creates a client from the Jersey configuration.
This approach affords to use the extended configuration of the Apache HttpClient in Dropwizard with a fluent interface of JerseyClient.
Constructor and Description |
---|
DropwizardApacheConnector(org.apache.http.impl.client.CloseableHttpClient client,
org.apache.http.client.config.RequestConfig defaultRequestConfig,
boolean chunkedEncodingEnabled) |
Modifier and Type | Method and Description |
---|---|
org.glassfish.jersey.client.ClientResponse |
apply(org.glassfish.jersey.client.ClientRequest jerseyRequest) |
Future<?> |
apply(org.glassfish.jersey.client.ClientRequest request,
org.glassfish.jersey.client.spi.AsyncConnectorCallback callback) |
void |
close() |
protected org.apache.http.HttpEntity |
getHttpEntity(org.glassfish.jersey.client.ClientRequest jerseyRequest)
Get an Apache's
HttpEntity
from Jersey's ClientRequest
Create a custom HTTP entity, because Jersey doesn't provide
a request stream or a byte buffer. |
String |
getName() |
public DropwizardApacheConnector(org.apache.http.impl.client.CloseableHttpClient client, @Nullable org.apache.http.client.config.RequestConfig defaultRequestConfig, boolean chunkedEncodingEnabled)
public org.glassfish.jersey.client.ClientResponse apply(org.glassfish.jersey.client.ClientRequest jerseyRequest)
apply
in interface org.glassfish.jersey.client.spi.Connector
apply
in interface org.glassfish.jersey.process.Inflector<org.glassfish.jersey.client.ClientRequest,org.glassfish.jersey.client.ClientResponse>
@Nullable protected org.apache.http.HttpEntity getHttpEntity(org.glassfish.jersey.client.ClientRequest jerseyRequest)
HttpEntity
from Jersey's ClientRequest
Create a custom HTTP entity, because Jersey doesn't provide a request stream or a byte buffer.
jerseyRequest
- representation of an HTTP request in JerseyHttpEntity
implementationpublic Future<?> apply(org.glassfish.jersey.client.ClientRequest request, org.glassfish.jersey.client.spi.AsyncConnectorCallback callback)
apply
in interface org.glassfish.jersey.client.spi.Connector
public String getName()
getName
in interface org.glassfish.jersey.client.spi.Connector
public void close()
close
in interface org.glassfish.jersey.client.spi.Connector
Copyright © 2018. All rights reserved.