Class HttpUrlConnector
java.lang.Object
org.glassfish.jersey.client.internal.HttpUrlConnector
- All Implemented Interfaces:
Connector,Inflector<ClientRequest,ClientResponse>
Default client transport connector using
HttpURLConnection.- Author:
- Marek Potociar
-
Constructor Summary
ConstructorsConstructorDescriptionHttpUrlConnector(Client client, HttpUrlConnectorProvider.ConnectionFactory connectionFactory, int chunkSize, boolean fixLengthStreaming, boolean setMethodWorkaround) Create newHttpUrlConnectorinstance. -
Method Summary
Modifier and TypeMethodDescriptionapply(ClientRequest request) Synchronously process client request into a response.Future<?>apply(ClientRequest request, AsyncConnectorCallback callback) Asynchronously process client request into a response.voidclose()Close connector and release all it's internally associated resources.getName()Get name of current connector.protected voidsecureConnection(JerseyClient client, HttpURLConnection uc) Secure connection if necessary.
-
Constructor Details
-
HttpUrlConnector
public HttpUrlConnector(Client client, HttpUrlConnectorProvider.ConnectionFactory connectionFactory, int chunkSize, boolean fixLengthStreaming, boolean setMethodWorkaround) Create newHttpUrlConnectorinstance.- Parameters:
client- JAX-RS client instance for which the connector is being created.connectionFactory-HttpsURLConnectionfactory to be used when creating connections.chunkSize- chunk size to use when using HTTP chunked transfer coding.fixLengthStreaming- specify if the thefixed-length streaming modeon the underlying HTTP URL connection instances should be used when sending requests.setMethodWorkaround- specify if the reflection workaround should be used to set HTTP URL connection method name. SeeHttpUrlConnectorProvider.SET_METHOD_WORKAROUNDfor details.
-
-
Method Details
-
apply
Description copied from interface:ConnectorSynchronously process client request into a response. The method is used by Jersey client runtime to synchronously send a request and receive a response.- Specified by:
applyin interfaceConnector- Specified by:
applyin interfaceInflector<ClientRequest,ClientResponse> - Parameters:
request- Jersey client request to be sent.- Returns:
- Jersey client response received for the client request.
-
apply
Description copied from interface:ConnectorAsynchronously process client request into a response. The method is used by Jersey client runtime to asynchronously send a request and receive a response. -
close
public void close()Description copied from interface:ConnectorClose connector and release all it's internally associated resources. -
secureConnection
Secure connection if necessary. Provided implementation setsHostnameVerifierandSSLSocketFactoryto give connection, if that is an instance ofHttpsURLConnection.- Parameters:
client- client associated with this client runtime.uc- http connection to be secured.
-
getName
Description copied from interface:ConnectorGet name of current connector. Should contain identification of underlying specification and optionally version number. Will be used in User-Agent header.- Specified by:
getNamein interfaceConnector- Returns:
- name of current connector. Returning
nullor empty string means not including this information in a generated "User-Agent" header.
-