public class HttpUrlConnector extends Object implements Connector
HttpURLConnection
.Constructor and Description |
---|
HttpUrlConnector(Client client,
HttpUrlConnectorProvider.ConnectionFactory connectionFactory,
int chunkSize,
boolean fixLengthStreaming,
boolean setMethodWorkaround)
Create new
HttpUrlConnector instance. |
Modifier and Type | Method and Description |
---|---|
ClientResponse |
apply(ClientRequest request)
Synchronously process client request into a response.
|
Future<?> |
apply(ClientRequest request,
AsyncConnectorCallback callback)
Asynchronously process client request into a response.
|
void |
close()
Close connector and release all it's internally associated resources.
|
String |
getName()
Get name of current connector.
|
protected void |
secureConnection(JerseyClient client,
HttpURLConnection uc)
Secure connection if necessary.
|
protected void |
setSslContextFactory(Client client,
ClientRequest request) |
public HttpUrlConnector(Client client, HttpUrlConnectorProvider.ConnectionFactory connectionFactory, int chunkSize, boolean fixLengthStreaming, boolean setMethodWorkaround)
HttpUrlConnector
instance.client
- JAX-RS client instance for which the connector is being created.connectionFactory
- HttpsURLConnection
factory to be used when creating connections.chunkSize
- chunk size to use when using HTTP chunked transfer coding.fixLengthStreaming
- specify if the the fixed-length streaming mode
on 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. See HttpUrlConnectorProvider.SET_METHOD_WORKAROUND
for details.public ClientResponse apply(ClientRequest request)
Connector
apply
in interface Connector
apply
in interface Inflector<ClientRequest,ClientResponse>
request
- Jersey client request to be sent.public Future<?> apply(ClientRequest request, AsyncConnectorCallback callback)
Connector
public void close()
Connector
protected void secureConnection(JerseyClient client, HttpURLConnection uc)
HostnameVerifier
and SSLSocketFactory
to give connection, if that
is an instance of HttpsURLConnection
.client
- client associated with this client runtime.uc
- http connection to be secured.protected void setSslContextFactory(Client client, ClientRequest request)
public String getName()
Connector
getName
in interface Connector
null
or empty string means not including
this information in a generated "User-Agent" header.Copyright © 2007-2024, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.