com.sun.jersey.client.urlconnection
Class URLConnectionClientHandler

java.lang.Object
  extended by com.sun.jersey.api.client.RequestWriter
      extended by com.sun.jersey.api.client.TerminatingClientHandler
          extended by com.sun.jersey.client.urlconnection.URLConnectionClientHandler
All Implemented Interfaces:
ClientHandler

public final class URLConnectionClientHandler
extends TerminatingClientHandler

A terminating client handler that uses HttpURLConnection or HttpsURLConnection to make HTTP requests and receive HTTP responses.

By default a HttpURLConnection or HttpsURLConnection instance is obtained using URL.openConnection(). This behaviour may be overridden by registering an HttpURLConnectionFactory instance when constructing this class.

For SSL configuration of HTTPS the HTTPSProperties may be used and an instance added as a property of the Client or ClientRequest.

Author:
[email protected]
See Also:
HttpURLConnectionFactory

Nested Class Summary
 
Nested classes/interfaces inherited from class com.sun.jersey.api.client.RequestWriter
RequestWriter.RequestEntityWriter, RequestWriter.RequestEntityWriterListener
 
Field Summary
static java.lang.String PROPERTY_HTTP_URL_CONNECTION_SET_METHOD_WORKAROUND
          A value of "true" declares that the client will try to set unsupported HTTP method to HttpURLConnection via reflection.
 
Fields inherited from class com.sun.jersey.api.client.RequestWriter
EMPTY_ANNOTATIONS
 
Constructor Summary
URLConnectionClientHandler()
           
URLConnectionClientHandler(HttpURLConnectionFactory httpURLConnectionFactory)
          Construct a new instance with an HTTP URL connection factory.
 
Method Summary
 ClientResponse handle(ClientRequest ro)
          ClientRequest handler.
 
Methods inherited from class com.sun.jersey.api.client.RequestWriter
getMessageBodyWorkers, getRequestEntityWriter, headerValueToString, setMessageBodyWorkers, writeRequestEntity
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_HTTP_URL_CONNECTION_SET_METHOD_WORKAROUND

public static final java.lang.String PROPERTY_HTTP_URL_CONNECTION_SET_METHOD_WORKAROUND
A value of "true" declares that the client will try to set unsupported HTTP method to HttpURLConnection via reflection. Enabling this feature might cause security related warnings/errors and it might break when other JDK implementation is used. Use only when you know what you are doing. The value MUST be an instance of Boolean. If the property is absent then the default value is "false".

See Also:
Constant Field Values
Constructor Detail

URLConnectionClientHandler

public URLConnectionClientHandler(HttpURLConnectionFactory httpURLConnectionFactory)
Construct a new instance with an HTTP URL connection factory.

Parameters:
httpURLConnectionFactory - the HTTP URL connection factory.

URLConnectionClientHandler

public URLConnectionClientHandler()
Method Detail

handle

public ClientResponse handle(ClientRequest ro)
ClientRequest handler.

Parameters:
ro - ClientRequest
Returns:
Server response represented as ClientResponse


Copyright © 2011 Oracle Corporation. All Rights Reserved.