org.glassfish.jersey.client
Class HttpUrlConnector

java.lang.Object
  extended by org.glassfish.jersey.client.HttpUrlConnector
All Implemented Interfaces:
Connector, Inflector<ClientRequest,ClientResponse>

public class HttpUrlConnector
extends Object
implements Connector

Default client transport connector using HttpURLConnection.

Author:
Marek Potociar (marek.potociar at oracle.com)

Nested Class Summary
static interface HttpUrlConnector.ConnectionFactory
          A factory for HttpURLConnection instances.
 
Constructor Summary
HttpUrlConnector()
          Create default HttpURLConnection-based Jersey client connector.
HttpUrlConnector(HttpUrlConnector.ConnectionFactory connectionFactory)
          Create default HttpURLConnection-based Jersey client connector.
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpUrlConnector

public HttpUrlConnector()
Create default HttpURLConnection-based Jersey client connector.


HttpUrlConnector

public HttpUrlConnector(HttpUrlConnector.ConnectionFactory connectionFactory)
Create default HttpURLConnection-based Jersey client connector.

Parameters:
connectionFactory - HttpURLConnection instance factory.
Method Detail

apply

public ClientResponse apply(ClientRequest request)
Description copied from interface: Connector
Synchronously 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:
apply in interface Connector
Specified by:
apply in interface Inflector<ClientRequest,ClientResponse>
Parameters:
request - Jersey client request to be sent.
Returns:
Jersey client response received for the client request.

apply

public Future<?> apply(ClientRequest request,
                       AsyncConnectorCallback callback)
Description copied from interface: Connector
Asynchronously process client request into a response. The method is used by Jersey client runtime to asynchronously send a request and receive a response.

Specified by:
apply in interface Connector
Parameters:
request - Jersey client request to be sent.
callback - Jersey asynchronous connector callback to asynchronously receive the request processing result (either a response or a failure).
Returns:
asynchronously executed task handle.

close

public void close()
Description copied from interface: Connector
Close connector and release all it's internally associated resources.

Specified by:
close in interface Connector

getName

public String getName()
Description copied from interface: Connector
Get name of current connector. Should contain identification of underlying specification and optionally version number. Will be used in User-Agent header.

Specified by:
getName in interface Connector
Returns:
name of current connector. Returning null or empty string means not including this information in a generated "User-Agent" header.


Copyright © 2007-2013, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.