com.oaklandsw.http
Class HttpURLConnection

java.lang.Object
  extended byjava.net.URLConnection
      extended byjava.net.HttpURLConnection
          extended bycom.oaklandsw.http.HttpURLConnection

public abstract class HttpURLConnection
extends java.net.HttpURLConnection

A URLConnection with support for HTTP-specific features.

The following properties can be used with this class:

http.proxyHost- specifies the host of the proxy server. Note this is identical to the method to specify the proxy host for the java.net.HttpURLConnection. See setProxyHost().

http.proxyPort- specifies the port of the proxy server. Note this is identical to the method to specify the proxy port for the java.net.HttpURLConnection. See setProxyPort(). Used in conjunction with http.proxyHost.

https.proxyHost- specifies the host of the proxy server. Note this is identical to the method to specify the proxy host for the java.net.HttpURLConnection. See setProxyHost(). Indicates the proxy server uses SSL. If both this and http.proxyHost as specified, this will take precedence.

https.proxyPort- specifies the port of the proxy server. Note this is identical to the method to specify the proxy port for the java.net.HttpURLConnection. See setProxyPort(). Indicates the proxy server uses SSL. Used in conjunction with https.proxyPort.

http.proxyUser- specifies the user name used for authentication with a proxy server if required. Note this is identical to the method to specify the proxy user for the java.net.HttpURLConnection. See setProxyUser()

http.proxyPassword- specifies the password used for authentication with a proxy server if required. Note this is identical to the method to specify the proxy password for the java.net.HttpURLConnection. See setProxyPassword().

http.nonProxyHosts- specifies a list of hosts to not direct to the proxy server. Note this is identical to the method to specify such hosts as for the java.net.HttpURLConnection. See setNonProxyHosts().

proxySet- setting this to any value causes all requests to go through the proxy server specified by proxyHost and proxyPort. Note that this method is obsolete and provided only for compatibility with JDK 1.0.2 implementations. The preferred method is to use http.proxyHost/Port. See setProxyHost()/setProxyPort().

proxyHost- specifies the host of the proxy server. Note this is identical to the method to specify the proxy host for the java.net.HttpURLConnection. This only works if proxySet is set to something. Note that this method is obsolete and provided only for compatibility with JDK 1.0.2 implementations. The preferred method is to use http.proxyHost. See setProxyHost().

proxyPort- specifies the port of the proxy server. Note this is identical to the method to specify the proxy port for the java.net.HttpURLConnection. This only works if proxySet is set to something. Note that this method is obsolete and provided only for compatibility with JDK 1.0.2 implementations. The preferred method is to use http.proxyPort. See setProxyPort().

com.oaklandsw.http.timeout- specifies the timeout value in milliseconds. See setDefaultTimeout().

com.oaklandsw.http.idleConnectionTimeout- the number of milliseconds that a connection can be idle before it is removed from the connection pool. See setIdleConnectionTimeout() and setDefaultIdleConnectionTimeout().

com.oaklandsw.http.idleConnectionPing- this is used to ping the connection before sending a POST request. The ping is issued if the connection was idle for at least the number of milliseconds specified. See setIdleConnectionPing() and setDefaultIdleConnectionPing().

com.oaklandsw.http.connectionRequestLimit- this is used to limit the number of requests on a connection. Once this limit is reached, the connection is closed. See setConnectionRequestLimit() and setDefaultConnectionRequestLimit().

com.oaklandsw.http.maxConnectionsPerHost- sets the maximum number of connections allowed to a given host:port. If not specified, a default of 2 is assumed. See setMaxConnectionsPerHost().

com.oaklandsw.http.tries- the number of times to try a sending an idempotent request if there is a problem with getting the response. Also the number of times to try an idle connection ping on a POST request if this is enabled. The default is 3. See setTries().

com.oaklandsw.http.retryInterval- the number of milliseconds to wait before retrying an idempotent request. The default is 0ms. See setRetryInterval().

com.oaklandsw.http.pipelining- set to any value to enable pipelining requests. The default is not set. See setDefaultPipelining().

com.oaklandsw.http.authenticationType- used to indicate a preferred authentication mode for pipelining or streaming. Set to one of "basic", "digest", or "ntlm". The default is not set. See setDefaultAuthenticationType().

com.oaklandsw.http.proxyAuthenticationType- used to indicate a preferred authentication mode for pipelining or streaming. Set to one of "basic", "digest", or "ntlm". The default is not set. See setDefaultProxyAuthenticationType().

com.oaklandsw.http.userAgent- set to specify an alternate value for the User-Agent HTTP header. The default is that the User-Agent header is set to DEFAULT_USER_AGENT.

com.oaklandsw.http.followRedirectsPost- specifies that redirect response codes are followed for a POST request. see setFollowRedirectsPost() for further details. The default is to not follow redirect response codes for post.

com.oaklandsw.http.cookiePolicy- specifies the default cookie policy to be used. See CookiePolicy for the possible values.

com.oaklandsw.http.skipEnvironmentInit- specified that all property settings are to be ignored. The property settings are normally read in the static initializer of this class. If this property is set none of the properties will be read. This is used in environments where the settings of some system properties might be for other HTTP client implementations.


Field Summary
static int AUTH_NORMAL
           
static int AUTH_PROXY
           
static int DEFAULT_MAX_CONNECTIONS
           
static int DEFAULT_RECEIVE_BUFFER_SIZE
          The default size of the socket read buffer.
static int DEFAULT_SEND_BUFFER_SIZE
          The default size of the socket write buffer.
static java.lang.String DEFAULT_USER_AGENT
           
static java.lang.String HTTP_METHOD_CONNECT
           
static java.lang.String HTTP_METHOD_DELETE
           
static java.lang.String HTTP_METHOD_GET
           
static java.lang.String HTTP_METHOD_HEAD
           
static java.lang.String HTTP_METHOD_OPTIONS
           
static java.lang.String HTTP_METHOD_POST
           
static java.lang.String HTTP_METHOD_PUT
           
static java.lang.String HTTP_METHOD_TRACE
           
static int MAX_TRIES
           
static int METHOD_PROP_ADD_CL_HEADER
          Add the content-length header if not already specified.
static int METHOD_PROP_CALCULATE_CONTENT_LEN
          The content length value is calculated (for potentially adding a content-length header) (POST/PUT).
static int METHOD_PROP_IGNORE_RESPONSE_BODY
          The response body is ignored.
static int METHOD_PROP_LEAVE_OPEN
          The connection is left open for this method (CONNECT)
static int METHOD_PROP_REDIRECT
          This method will follow redirects.
static int METHOD_PROP_REQ_LINE_HOST_PORT
          The request line has only the host/port (CONNECT)
static int METHOD_PROP_REQ_LINE_STAR
          The request line consists of only a "*" (for OPTIONS)
static int METHOD_PROP_REQ_LINE_URL
          The request line has a URL (most HTTP methods)
static int METHOD_PROP_RETRY
          This method will be retried automatically.
static int METHOD_PROP_SEND_CONTENT_TYPE
          A content-type header is automatically added (PUT).
static int METHOD_PROP_SUPPORTS_TUNNELED
          This method supports the tunneling streaming mode (CONNECT)
static int METHOD_PROP_SWITCH_TO_POST
          This is used for an HTTP GET method.
static int METHOD_PROP_UNKNOWN_METHOD
          A method was specified, but is not known (in the table of methods)
static int METHOD_PROP_UNSPECIFIED_METHOD
          This is what the method properties are set to initially, this value indicates no method was specified.
static int NTLM_ENCODING_OEM
           
static int NTLM_ENCODING_UNICODE
           
static int PIPE_MAX_CONNECTIONS
          Use as many connections as possible (up to the maximum number of connections to a host/port), spreading the requests across all available connections evenly.
static int PIPE_NONE
           
static int PIPE_PIPELINE
          Use pipelining
static int PIPE_STANDARD_OPTIONS
           
static int SOCKET_RECEIVE
           
static int SOCKET_SEND
           
static java.lang.String WEBDAV_METHOD_ACL
           
static java.lang.String WEBDAV_METHOD_BASELINE_CONTROL
           
static java.lang.String WEBDAV_METHOD_CHECKIN
           
static java.lang.String WEBDAV_METHOD_CHECKOUT
           
static java.lang.String WEBDAV_METHOD_COPY
           
static java.lang.String WEBDAV_METHOD_DELETE
           
static java.lang.String WEBDAV_METHOD_LOCK
           
static java.lang.String WEBDAV_METHOD_MERGE
           
static java.lang.String WEBDAV_METHOD_MKCOL
           
static java.lang.String WEBDAV_METHOD_MKWORKSPACE
           
static java.lang.String WEBDAV_METHOD_MOVE
           
static java.lang.String WEBDAV_METHOD_PROPFIND
           
static java.lang.String WEBDAV_METHOD_PROPPATCH
           
static java.lang.String WEBDAV_METHOD_REPORT
           
static java.lang.String WEBDAV_METHOD_SEARCH
           
static java.lang.String WEBDAV_METHOD_UNCHECKOUT
           
static java.lang.String WEBDAV_METHOD_UNLOCK
           
static java.lang.String WEBDAV_METHOD_UPDATE
           
static java.lang.String WEBDAV_METHOD_VERSION_CONTROL
           
 
Fields inherited from class java.net.HttpURLConnection
HTTP_ACCEPTED, HTTP_BAD_GATEWAY, HTTP_BAD_METHOD, HTTP_BAD_REQUEST, HTTP_CLIENT_TIMEOUT, HTTP_CONFLICT, HTTP_CREATED, HTTP_ENTITY_TOO_LARGE, HTTP_FORBIDDEN, HTTP_GATEWAY_TIMEOUT, HTTP_GONE, HTTP_INTERNAL_ERROR, HTTP_LENGTH_REQUIRED, HTTP_MOVED_PERM, HTTP_MOVED_TEMP, HTTP_MULT_CHOICE, HTTP_NO_CONTENT, HTTP_NOT_ACCEPTABLE, HTTP_NOT_AUTHORITATIVE, HTTP_NOT_FOUND, HTTP_NOT_IMPLEMENTED, HTTP_NOT_MODIFIED, HTTP_OK, HTTP_PARTIAL, HTTP_PAYMENT_REQUIRED, HTTP_PRECON_FAILED, HTTP_PROXY_AUTH, HTTP_REQ_TOO_LONG, HTTP_RESET, HTTP_SEE_OTHER, HTTP_SERVER_ERROR, HTTP_UNAUTHORIZED, HTTP_UNAVAILABLE, HTTP_UNSUPPORTED_TYPE, HTTP_USE_PROXY, HTTP_VERSION
 
Constructor Summary
HttpURLConnection()
           
HttpURLConnection(java.net.URL urlParam)
          Constructor, works the same as the constructor for java.net.HttpURLConnection.
 
Method Summary
 void addRequestProperty(java.lang.String key, java.lang.String value)
           
static void closeAllPooledConnections()
          Close all pooled connections that are not currently in use.
 void connect()
           
 void disconnect()
           
static java.lang.String dumpAll()
           
static void dumpAll(java.io.PrintWriter out)
           
 void finalize()
          Releases the associated transport collection when this object is to be collected.
 java.lang.String getAuthenticationDummyContent()
          For internal use only (public for testing)
 java.lang.String getAuthenticationDummyMethod()
          For internal use only (public for testing)
 int getAuthenticationType()
          Returns the authentication type associated with this connection.
 Callback getCallback()
          Gets the Callback object associated with this connection.
 java.lang.String getCipherSuite()
          Returns the cipher suite associated with this connection.
 HttpConnection getConnection()
          Returns the connection associated with this object, if any.
static HttpConnectionManager getConnectionManager()
          Returns the HttpConnectionManager
static java.lang.String getConnectionPool()
          Prints all pooled connections to System.out.
 java.lang.String getConnectionProxyHost()
          Returns the current value of the proxy server host on this connection.
 java.lang.String getConnectionProxyPassword()
          Returns the current value of the proxy server password on this connection.
 int getConnectionProxyPort()
          Returns the current value of the proxy server port number.
 java.lang.String getConnectionProxyUser()
          Returns the current value of the proxy user on this connection.
 int getConnectionRequestLimit()
          Return the connection request limit value associated with this connection.
 int getConnectionTimeout()
          Return the connection timeout value associated with this connection.
 CookieContainer getCookieContainer()
          Returns the CookieContainer associated with this request.
 java.lang.String getCookiePolicy()
          Returns the CookiePolicy string associated with this request.
static int getDefaultAuthenticationType()
          Gets the default authentication type.
static Callback getDefaultCallback()
          Returns the default Callback object.
static int getDefaultConnectionRequestLimit()
          Return the default idle connection ping value.
static int getDefaultConnectionTimeout()
          Return the default connection timeout value.
static HostnameVerifier getDefaultHostnameVerifier()
          Returns the default hostname verifier used for SSL connections.
static int getDefaultIdleConnectionPing()
          Return the default idle connection ping value.
static int getDefaultIdleConnectionTimeout()
          Return the default idle connection timeout value.
static int getDefaultMaxForwards()
          Get the number of forwards and authentication retries allowed.
static int getDefaultMaxTries()
          Get the number of times an idempotent request is tried.
static int getDefaultPipeliningMaxDepth()
          Get the value of the maximum depth of pipelining for all connections.
static int getDefaultPipeliningOptions()
          Get the value of pipelining options for all connections.
static int getDefaultProxyAuthenticationType()
          Gets the default proxy authentication type.
static int getDefaultRequestTimeout()
          Return the default request timeout value.
static AbstractSocketFactory getDefaultSocketFactory()
          Returns the default socket factory used for HTTP socket connections.
static javax.net.ssl.SSLSocketFactory getDefaultSSLSocketFactory()
          Returns the default SSL socket factory used for SSL connections.
static boolean getDefaultThrowFileNotFoundOn404()
          For JRE compatibility throw a FileNotFoundException when a 404 response is detected.
static int getDefaultTimeout()
          Deprecated. please use getDefaultConnectionTimeout() or getDefaultRequestTimeout()
static HttpUserAgent getDefaultUserAgent()
          Gets the default user agent.
 boolean getDoAuthentication()
          Automatic processing of responses where authentication is required (status codes 401 and 407).
 java.io.InputStream getErrorStream()
          Returns the data associated with the connection in the event of an error.
 java.lang.String getHeaderField(int position)
           
 java.lang.String getHeaderField(java.lang.String name)
           
 java.lang.String getHeaderFieldKey(int keyPosition)
           
 java.util.Map getHeaderFields()
           
 int getHeadersLength()
          Returns the number of response headers.
 HostnameVerifier getHostnameVerifier()
          Returns the hostname verifier used for this SSL connection.
 int getIdleConnectionPing()
          Return the idle connection ping value associated with this connection.
 int getIdleConnectionTimeout()
          Return the idle connection timeout value associated with this connection.
 java.io.InputStream getInputStream()
          Gets an InputStream for the data returned in the response.
 boolean getInstanceFollowRedirects()
          Whether or not I should automatically follow HTTP redirects (status code 302, etc) Redirects are followed only for GET, POST, or HEAD requests.
 java.security.cert.Certificate[] getLocalCertificates()
          Returns the certificates(s) that were sent to the server when the connection was established.
static int getMaxConnectionsPerHost()
          Get the maximum number of connections allowed for a given host:port.
static boolean getMultiCredentialsPerAddress()
          Allow multiple sets of authentication credentials per destination Internet address (host/port).
static java.lang.String getNonProxyHosts()
          Returns the current value of the hosts to not be accessed through the proxy server.
static int getNtlmPreferredEncoding()
          Gets the preferred encoding for NTLM messages.
 java.io.OutputStream getOutputStream()
           
 int getPipeliningMaxDepth()
          Get the value of the maximum depth of pipelining for this connection.
 int getPipeliningOptions()
          Get the value of pipelining options for this connection.
static boolean getPreemptiveAuthentication()
          Deprecated.  
 int getProxyAuthenticationType()
          Returns the proxy authentication type associated with this connection.
static java.lang.String getProxyHost()
          Returns the current value of the proxy server host.
static java.lang.String getProxyPassword()
          Returns the current value of the proxy password.
static int getProxyPort()
          Returns the current value of the proxy server port number.
static java.lang.String getProxyUser()
          Returns the current value of the proxy server user.
 java.io.Reader getReader()
          Gets a Reader for the data returned in the response.
 java.lang.String getRequestProperty(java.lang.String key)
           
 int getRequestTimeout()
          Return the request timeout value associated with this connection.
 int getResponseCode()
           
 java.lang.String getResponseMessage()
           
static int getRetryInterval()
          Get the interval to wait before each retry of a failed request.
 java.security.cert.Certificate[] getServerCertificates()
          Returns the server's certificate chain that was established when the session was setup.
static int getSocketBufferSize(int type)
          Gets the buffer size to be used for the underlying sockets for all connections.
 AbstractSocketFactory getSocketFactory()
          Returns the socket factory used for this HTTP socket connection.
 javax.net.ssl.SSLSocketFactory getSSLSocketFactory()
          Returns the SSL socket factory used this SSL connection.
static java.lang.String getStaticConfiguration()
           
static java.lang.String getStatistics()
          Returns various statistics in printed form
 int getTimeout()
          Deprecated. please use either getConnectionTimeout() or getRequestTimeout()
static int getTries()
          Deprecated. please use getDefaultMaxTries()
 java.lang.String getUrlString()
           
static boolean getUse10KeepAlive()
          Get the option to include the HTTP 1.0 Keep-Alive headers in HTTP requests.
 HttpUserAgent getUserAgent()
          Sets the user agent for this connection.
static void immediateShutdown()
          Immediately close all connections and stop all work in progress.
 boolean isConnected()
          Returns true if this connection is currently connected.
 boolean isConnectionProxySsl()
          Returns true if the proxy is to use SSL for this connection.
static boolean isDefaultForceSSL()
          Gets the value indicating if SSL is forced for this all URL connections.
static boolean isDefaultPipelining()
          Get the value of pipelining enablement for all connections.
static boolean isExplicitClose()
          Deprecated.  
 boolean isForceSSL()
          Gets the value indicating if SSL is forced for this URL connection.
static boolean isNonProxyHost(java.lang.String hostName)
          Returns true if the specified host is treated as a non-proxy host.
 boolean isPipelining()
          Get the value of pipelining enablement for this connection.
static boolean isProxySsl()
          Returns true if the proxy is to use SSL for all connections.
static HttpURLConnection openConnection(java.net.URL url)
          Creates an HTTP connection directly, without using the URLStreamHandler.
static void pipelineBlock()
          Blocks until all pipelined HttpURLConnections are completed on this thread.
 void pipelineExecute()
          Begins the pipelined execution of this connection.
 void pipelineExecuteAsync()
          Begins the pipelined execution of this connection, when you don't need to block for completion of the connection or if this thread cannot tolerate blocking.
static java.lang.String plOptionsToString(int options)
          Returns a string representation of the specified pipelining options.
static void resetCachedCredentials()
          Flushes all cached credentials.
static void resetGlobalState()
          Resets the global persistent state.
static void resetStatistics()
          Resets the statistics counters.
static void resetUrlConReleased()
           
 void setAuthenticationDummyContent(java.lang.String authenticationDummyContent)
          For internal use only (public for testing)
 void setAuthenticationDummyMethod(java.lang.String authenticationDummyMethod)
          For internal use only (public for testing)
 void setAuthenticationType(int authenticationType)
          Sets the authentication type for this connection used for pipelining or streaming.
 void setCallback(Callback cb)
          Sets the Callback object associated with this connection.
 void setChunkedStreamingMode(int chunkLen)
          Used to allow data to be sent on with the HTTP request using chunked encoding.
 void setConnection(HttpConnection conn)
          Associates a connection with this object.
 void setConnectionProxyHost(java.lang.String host)
          Sets the host to be used as a proxy server for this connection.
 void setConnectionProxyPassword(java.lang.String password)
          Sets the password to be used to authenticate with the proxy server for this connection.
 void setConnectionProxyPort(int port)
          Sets the port on the proxy server host.
 void setConnectionProxySsl(boolean ssl)
          Enables or disables the use of SSL for the proxy.
 void setConnectionProxyUser(java.lang.String user)
          Sets the user to be used to authenticate with the proxy server.
 void setConnectionRequestLimit(int requests)
          Sets the number of HttpURLConnection requests that can be used on the underlying socket connection.
 void setConnectionTimeout(int ms)
          Set the connection timeout value associated with this connection.
 void setCookieSupport(CookieContainer container, java.lang.String policy)
          Associates the given CookieContainer with this connection.
static void setDefaultAuthenticationType(int type)
          Sets the default authentication type.
static void setDefaultCallback(Callback cb)
          Sets the Callback object for all connections.
static void setDefaultConnectionRequestLimit()
          Set the default idle connection ping value to its default value (0 seconds).
static void setDefaultConnectionRequestLimit(int requests)
          Set the default idle connection request limit value.
static void setDefaultConnectionTimeout(int ms)
          Set the default connection timeout value.
static void setDefaultCookieSupport(CookieContainer container, java.lang.String policy)
           
static void setDefaultForceSSL(boolean forceSSL)
          Forces the URL connection to use SSL regardless of the protocol specified for all connections.
static void setDefaultHostnameVerifier(HostnameVerifier verifier)
          Sets the default hostname verifier used for SSL connections
static void setDefaultIdleConnectionPing()
          Set the default idle connection ping value to its default value (0 seconds).
static void setDefaultIdleConnectionPing(int ms)
          Set the default idle connection ping value.
static void setDefaultIdleConnectionTimeout()
          Set the default idle connection timeout value to its default value (14 seconds).
static void setDefaultIdleConnectionTimeout(int ms)
          Set the default idle connection timeout value.
static void setDefaultMaxForwards(int forwards)
          Set the number of times a request can be redirected or it can have its authentication retried in the event of an authentication failure (particularly in a pipelined environment).
static void setDefaultMaxTries(int tries)
          Set the number of times an idempotent request is to be tried before considering it a failure.
static void setDefaultPipelining(boolean enabled)
          Enable pipelining for all connections.
static void setDefaultPipeliningMaxDepth(int pipeliningMaxDepth)
          Sets the maximum depth of pipelining for all connections.
static void setDefaultPipeliningOptions(int pipeliningOptions)
          Set specific pipeline options for all connections.
static void setDefaultProxyAuthenticationType(int type)
          Sets the default proxy authentication type.
static void setDefaultRequestTimeout(int ms)
          Set the default request timeout value.
static void setDefaultSocketFactory(AbstractSocketFactory factory)
          Sets the default socket factory used for HTTP socket connections.
static void setDefaultSSLSocketFactory(javax.net.ssl.SSLSocketFactory factory)
          Sets the default SSL socket factory used for SSL connections.
static void setDefaultThrowFileNotFoundOn404(boolean doThrow)
          For JRE compatibility throw a FileNotFoundException when a 404 response is detected.
static void setDefaultTimeout(int ms)
          Set the default timeout value.
static void setDefaultUserAgent(HttpUserAgent userAgent)
          Sets the default user agent.
 void setDoAuthentication(boolean doAuthentication)
          Automatic processing of responses where authentication is required (status codes 401 and 407).
static void setExplicitClose(boolean explicitClose)
          Deprecated.  
 void setFixedLengthStreamingMode(int fixedLen)
          Used to allow data to be sent on with the HTTP request without buffering and when the length of the data is known in advance.
 void setForceSSL(boolean forceSSL)
          Forces the URL connection to use SSL regardless of the protocol specified.
 void setHostnameVerifier(HostnameVerifier verifier)
          Sets the hostname verifier used for this SSL connection
 void setIdleConnectionPing(int ms)
          Set the idle connection ping value associated with this connection.
 void setIdleConnectionTimeout(int ms)
          Set the idle connection timeout value associated with this connection.
 void setInstanceFollowRedirects(boolean followRedirects)
          Set whether or not I should automatically follow HTTP redirects (status code 302, etc).
static void setMaxConnectionsPerHost(int maxConnections)
          Set the maximum number of connections allowed for a given host:port.
static void setMethodProperties(java.lang.String methodName, int properties)
          Sets the properties for the specified method to the specified property value.
static void setMultiCredentialsPerAddress(boolean multi)
          Allow multiple sets of authentication credentials per destination Internet address (host/port).
static void setNonProxyHosts(java.lang.String hosts)
          Sets the hosts to be excluded from the proxy mechanism.
static void setNtlmPreferredEncoding(int encoding)
          Sets the preferred encoding for NTLM authenticate messages.
 void setPipelining(boolean enabled)
          Enable pipelining for this connection.
 void setPipeliningMaxDepth(int pipeliningMaxDepth)
          Sets the maximum depth of pipelining for this connection.
 void setPipeliningOptions(int pipeliningOptions)
          Set specific pipeline options for this connection.
static void setPreemptiveAuthentication(boolean enabled)
          Deprecated.  
 void setProxyAuthenticationType(int authenticationType)
          Sets the proxy authentication type for this connection.
static void setProxyHost(java.lang.String host)
          Sets the host to be used as a proxy server.
static void setProxyPassword(java.lang.String password)
          Sets the password to be used to authenticate with the proxy server for this connection.
static void setProxyPort(int port)
          Sets the port on the proxy server host.
static void setProxySsl(boolean ssl)
          Enables or disables the use of SSL for the proxy for all connections.
static void setProxyUser(java.lang.String user)
          Sets the user to be used to authenticate with the proxy server.
 void setRawStreamingMode(boolean useRaw)
          Used to allow direct access to sending the HTTP request.
 void setRequestMethod(java.lang.String meth)
           
 void setRequestProperty(java.lang.String key, java.lang.String value)
           
 void setRequestTimeout(int ms)
          Set the request timeout value associated with this connection.
static void setRetryInterval(int ms)
          Set the interval to wait before each retry of a failed request.
static void setSocketBufferSize(int type, int size)
          Sets the buffer size to be used for the underlying sockets for all connections.
 void setSocketFactory(AbstractSocketFactory factory)
          Sets the default socket factory used for this HTTP socket connection.
 void setSSLSocketFactory(javax.net.ssl.SSLSocketFactory factory)
          Sets the SSL socket factory used for this SSL connection.
 void setTimeout(int ms)
          Set the timeout value associated with this connection.
static void setTries(int tries)
          Deprecated. please use setDefaultMaxTries()
 void setTunneledStreamingMode(boolean useTunneled)
          Used to allow direct access to a tunneled connection.
static void setUse10KeepAlive(boolean use)
          Set the option to include the HTTP 1.0 Keep-Alive headers in HTTP requests.
 void setUserAgent(HttpUserAgent userAgent)
          Sets the user agent for this connection.
 java.lang.String toString()
           
 boolean usingProxy()
           
 
Methods inherited from class java.net.HttpURLConnection
getFollowRedirects, getHeaderFieldDate, getPermission, getRequestMethod, setFollowRedirects
 
Methods inherited from class java.net.URLConnection
getAllowUserInteraction, getContent, getContent, getContentEncoding, getContentLength, getContentType, getDate, getDefaultAllowUserInteraction, getDefaultRequestProperty, getDefaultUseCaches, getDoInput, getDoOutput, getExpiration, getFileNameMap, getHeaderFieldInt, getIfModifiedSince, getLastModified, getRequestProperties, getURL, getUseCaches, guessContentTypeFromName, guessContentTypeFromStream, setAllowUserInteraction, setContentHandlerFactory, setDefaultAllowUserInteraction, setDefaultRequestProperty, setDefaultUseCaches, setDoInput, setDoOutput, setFileNameMap, setIfModifiedSince, setUseCaches
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

HTTP_METHOD_GET

public static final java.lang.String HTTP_METHOD_GET
See Also:
Constant Field Values

HTTP_METHOD_POST

public static final java.lang.String HTTP_METHOD_POST
See Also:
Constant Field Values

HTTP_METHOD_PUT

public static final java.lang.String HTTP_METHOD_PUT
See Also:
Constant Field Values

HTTP_METHOD_OPTIONS

public static final java.lang.String HTTP_METHOD_OPTIONS
See Also:
Constant Field Values

HTTP_METHOD_DELETE

public static final java.lang.String HTTP_METHOD_DELETE
See Also:
Constant Field Values

HTTP_METHOD_HEAD

public static final java.lang.String HTTP_METHOD_HEAD
See Also:
Constant Field Values

HTTP_METHOD_TRACE

public static final java.lang.String HTTP_METHOD_TRACE
See Also:
Constant Field Values

HTTP_METHOD_CONNECT

public static final java.lang.String HTTP_METHOD_CONNECT
See Also:
Constant Field Values

WEBDAV_METHOD_PROPFIND

public static final java.lang.String WEBDAV_METHOD_PROPFIND
See Also:
Constant Field Values

WEBDAV_METHOD_PROPPATCH

public static final java.lang.String WEBDAV_METHOD_PROPPATCH
See Also:
Constant Field Values

WEBDAV_METHOD_MKCOL

public static final java.lang.String WEBDAV_METHOD_MKCOL
See Also:
Constant Field Values

WEBDAV_METHOD_COPY

public static final java.lang.String WEBDAV_METHOD_COPY
See Also:
Constant Field Values

WEBDAV_METHOD_MOVE

public static final java.lang.String WEBDAV_METHOD_MOVE
See Also:
Constant Field Values

WEBDAV_METHOD_DELETE

public static final java.lang.String WEBDAV_METHOD_DELETE
See Also:
Constant Field Values

WEBDAV_METHOD_LOCK

public static final java.lang.String WEBDAV_METHOD_LOCK
See Also:
Constant Field Values

WEBDAV_METHOD_UNLOCK

public static final java.lang.String WEBDAV_METHOD_UNLOCK
See Also:
Constant Field Values

WEBDAV_METHOD_SEARCH

public static final java.lang.String WEBDAV_METHOD_SEARCH
See Also:
Constant Field Values

WEBDAV_METHOD_VERSION_CONTROL

public static final java.lang.String WEBDAV_METHOD_VERSION_CONTROL
See Also:
Constant Field Values

WEBDAV_METHOD_BASELINE_CONTROL

public static final java.lang.String WEBDAV_METHOD_BASELINE_CONTROL
See Also:
Constant Field Values

WEBDAV_METHOD_REPORT

public static final java.lang.String WEBDAV_METHOD_REPORT
See Also:
Constant Field Values

WEBDAV_METHOD_CHECKOUT

public static final java.lang.String WEBDAV_METHOD_CHECKOUT
See Also:
Constant Field Values

WEBDAV_METHOD_CHECKIN

public static final java.lang.String WEBDAV_METHOD_CHECKIN
See Also:
Constant Field Values

WEBDAV_METHOD_UNCHECKOUT

public static final java.lang.String WEBDAV_METHOD_UNCHECKOUT
See Also:
Constant Field Values

WEBDAV_METHOD_MKWORKSPACE

public static final java.lang.String WEBDAV_METHOD_MKWORKSPACE
See Also:
Constant Field Values

WEBDAV_METHOD_MERGE

public static final java.lang.String WEBDAV_METHOD_MERGE
See Also:
Constant Field Values

WEBDAV_METHOD_UPDATE

public static final java.lang.String WEBDAV_METHOD_UPDATE
See Also:
Constant Field Values

WEBDAV_METHOD_ACL

public static final java.lang.String WEBDAV_METHOD_ACL
See Also:
Constant Field Values

METHOD_PROP_RETRY

public static final int METHOD_PROP_RETRY
This method will be retried automatically.

See Also:
Constant Field Values

METHOD_PROP_REDIRECT

public static final int METHOD_PROP_REDIRECT
This method will follow redirects.

See Also:
Constant Field Values

METHOD_PROP_SWITCH_TO_POST

public static final int METHOD_PROP_SWITCH_TO_POST
This is used for an HTTP GET method. If a GET method was specified, and getOutputStream() is subsequently called, this changes the method to a POST method. This is for JDK compatibility.

See Also:
Constant Field Values

METHOD_PROP_ADD_CL_HEADER

public static final int METHOD_PROP_ADD_CL_HEADER
Add the content-length header if not already specified. Used for the POST and PUT methods.

See Also:
Constant Field Values

METHOD_PROP_IGNORE_RESPONSE_BODY

public static final int METHOD_PROP_IGNORE_RESPONSE_BODY
The response body is ignored. Used for the HEAD method.

See Also:
Constant Field Values

METHOD_PROP_REQ_LINE_URL

public static final int METHOD_PROP_REQ_LINE_URL
The request line has a URL (most HTTP methods)

See Also:
Constant Field Values

METHOD_PROP_REQ_LINE_STAR

public static final int METHOD_PROP_REQ_LINE_STAR
The request line consists of only a "*" (for OPTIONS)

See Also:
Constant Field Values

METHOD_PROP_REQ_LINE_HOST_PORT

public static final int METHOD_PROP_REQ_LINE_HOST_PORT
The request line has only the host/port (CONNECT)

See Also:
Constant Field Values

METHOD_PROP_CALCULATE_CONTENT_LEN

public static final int METHOD_PROP_CALCULATE_CONTENT_LEN
The content length value is calculated (for potentially adding a content-length header) (POST/PUT).

See Also:
Constant Field Values

METHOD_PROP_SEND_CONTENT_TYPE

public static final int METHOD_PROP_SEND_CONTENT_TYPE
A content-type header is automatically added (PUT). This is only used is the METHOD_PROP_CALCULATE_CONTENT_LEN is also set.

See Also:
Constant Field Values

METHOD_PROP_LEAVE_OPEN

public static final int METHOD_PROP_LEAVE_OPEN
The connection is left open for this method (CONNECT)

See Also:
Constant Field Values

METHOD_PROP_SUPPORTS_TUNNELED

public static final int METHOD_PROP_SUPPORTS_TUNNELED
This method supports the tunneling streaming mode (CONNECT)

See Also:
Constant Field Values

METHOD_PROP_UNSPECIFIED_METHOD

public static final int METHOD_PROP_UNSPECIFIED_METHOD
This is what the method properties are set to initially, this value indicates no method was specified. If this is the case, then the GET method is assumed.

See Also:
Constant Field Values

METHOD_PROP_UNKNOWN_METHOD

public static final int METHOD_PROP_UNKNOWN_METHOD
A method was specified, but is not known (in the table of methods)

See Also:
Constant Field Values

NTLM_ENCODING_UNICODE

public static final int NTLM_ENCODING_UNICODE
See Also:
Constant Field Values

NTLM_ENCODING_OEM

public static final int NTLM_ENCODING_OEM
See Also:
Constant Field Values

PIPE_NONE

public static final int PIPE_NONE
See Also:
Constant Field Values

PIPE_PIPELINE

public static final int PIPE_PIPELINE
Use pipelining

See Also:
Constant Field Values

PIPE_MAX_CONNECTIONS

public static final int PIPE_MAX_CONNECTIONS
Use as many connections as possible (up to the maximum number of connections to a host/port), spreading the requests across all available connections evenly. If this is not set, a single connection will be used for all requests.

See Also:
Constant Field Values

PIPE_STANDARD_OPTIONS

public static final int PIPE_STANDARD_OPTIONS
See Also:
Constant Field Values

AUTH_NORMAL

public static final int AUTH_NORMAL
See Also:
Constant Field Values

AUTH_PROXY

public static final int AUTH_PROXY
See Also:
Constant Field Values

SOCKET_RECEIVE

public static final int SOCKET_RECEIVE
See Also:
Constant Field Values

SOCKET_SEND

public static final int SOCKET_SEND
See Also:
Constant Field Values

DEFAULT_SEND_BUFFER_SIZE

public static final int DEFAULT_SEND_BUFFER_SIZE
The default size of the socket write buffer. This is large to exploit pipelining if that is used.

See Also:
Constant Field Values

DEFAULT_RECEIVE_BUFFER_SIZE

public static final int DEFAULT_RECEIVE_BUFFER_SIZE
The default size of the socket read buffer.

See Also:
Constant Field Values

DEFAULT_USER_AGENT

public static java.lang.String DEFAULT_USER_AGENT

DEFAULT_MAX_CONNECTIONS

public static int DEFAULT_MAX_CONNECTIONS

MAX_TRIES

public static int MAX_TRIES
Constructor Detail

HttpURLConnection

public HttpURLConnection()

HttpURLConnection

public HttpURLConnection(java.net.URL urlParam)
Constructor, works the same as the constructor for java.net.HttpURLConnection.

Method Detail

openConnection

public static HttpURLConnection openConnection(java.net.URL url)
Creates an HTTP connection directly, without using the URLStreamHandler. This is used if the currently selected HTTP implementation is something other than the Oakland Software implementation, and you need a Oakland Software HTTP connection. It is exactly the same as calling java.net.URL.openConnection()

See Also:
URL.openConnection()

finalize

public void finalize()
Releases the associated transport collection when this object is to be collected.


setRequestMethod

public void setRequestMethod(java.lang.String meth)
See Also:
HttpURLConnection.setRequestMethod(String)

setRequestProperty

public void setRequestProperty(java.lang.String key,
                               java.lang.String value)
See Also:
URLConnection.setRequestProperty(String,String)

addRequestProperty

public void addRequestProperty(java.lang.String key,
                               java.lang.String value)
See Also:
URLConnection.addRequestProperty(String,String)

getRequestProperty

public java.lang.String getRequestProperty(java.lang.String key)
See Also:
URLConnection.getRequestProperty(String)

setInstanceFollowRedirects

public final void setInstanceFollowRedirects(boolean followRedirects)
Set whether or not I should automatically follow HTTP redirects (status code 302, etc).

Parameters:
followRedirects - true to follow redirects, false otherwise

getInstanceFollowRedirects

public final boolean getInstanceFollowRedirects()
Whether or not I should automatically follow HTTP redirects (status code 302, etc) Redirects are followed only for GET, POST, or HEAD requests.

Returns:
true if I will automatically follow HTTP redirects

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws java.io.IOException
Throws:
java.io.IOException
See Also:
URLConnection.getOutputStream()

usingProxy

public boolean usingProxy()
See Also:
HttpURLConnection.usingProxy()

connect

public void connect()
             throws java.io.IOException
Throws:
java.io.IOException
See Also:
URLConnection.connect()

getConnectionManager

public static HttpConnectionManager getConnectionManager()
Returns the HttpConnectionManager


setConnection

public void setConnection(HttpConnection conn)
                   throws java.io.IOException
Associates a connection with this object. This is used in conjunction with HttpConnectionManager.getConnection() to provide a means of controlling the allocation of socket connections and associating them with HttpURLConnections. To close the underlying socket connection, call disconnect() on this object.

The caller must ensure that the same HttpConnection object is not used by multiple HttpURLConnections.

Throws:
java.io.IOException - - if the connection cannot be opened
java.lang.IllegalStateException - - if a connection has already been associated with this object.

getConnection

public HttpConnection getConnection()
Returns the connection associated with this object, if any.

Returns:
the connection associated with this object.

isConnected

public boolean isConnected()
Returns true if this connection is currently connected.

Returns:
a boolean value, true if connected.

getResponseCode

public int getResponseCode()
                    throws java.io.IOException
Throws:
java.io.IOException
See Also:
HttpURLConnection.getResponseCode()

getResponseMessage

public java.lang.String getResponseMessage()
                                    throws java.io.IOException
Throws:
java.io.IOException
See Also:
HttpURLConnection.getResponseMessage()

setChunkedStreamingMode

public void setChunkedStreamingMode(int chunkLen)
Used to allow data to be sent on with the HTTP request using chunked encoding. The size of each chunk is determined by the size of the write() calls to the OutputStream.

This uses the HTTP chunked transfer encoding mode, which is an optional feature not supported by all HTTP servers.

Use this if:

Use of this method avoids double-copying of the data.

When using this method, you may not call write(int) method on the returned stream. If you must use single byte writes, then wrap the returned stream in a BufferedOutputStream(). The chunk size will then be the size of that buffer.

This is used to improve performance sending by not first buffering the data associated with the request. If the request requires authentication or redirection, this will not work as the data will have been sent. In this case, you will get an HttpRetryException

Parameters:
chunkLen - - This is ignored and exists for compatibility with the Java HttpURLConnection API. The size of each chunk is based on the size of each write to the stream.
Throws:
java.lang.IllegalStateException - - If the connection is already connected or a different streaming mode has been set.

setFixedLengthStreamingMode

public void setFixedLengthStreamingMode(int fixedLen)
Used to allow data to be sent on with the HTTP request without buffering and when the length of the data is known in advance.

Use of this method avoids double-copying of the data.

This is used to improve performance sending by not first buffering the data associated with the request. If the request requires authentication or redirection, this will not work as the data will have been sent. In this case, you will get an HttpRetryException

Parameters:
fixedLen - - The size of the data being sent (the Content-Length)
Throws:
java.lang.IllegalStateException - - If the connection is already connected or a different streaming mode has been set.

setRawStreamingMode

public void setRawStreamingMode(boolean useRaw)
Used to allow direct access to sending the HTTP request.

When using this option, you get the OutputStream using getOutputStream() and then write the HTTP request that stream. After the request is written close the stream. The HTTP response is handled normally.

This is used if you wish to have complete control over the exact content of the HTTP request.

Parameters:
useRaw - True if enabling raw streaming, false if not
Throws:
java.lang.IllegalStateException - - If the connection is already connected or a different streaming mode has been set.

setTunneledStreamingMode

public void setTunneledStreamingMode(boolean useTunneled)
Used to allow direct access to a tunneled connection.

When using this option, you get the OutputStream using getOutputStream() and then can write to the tunneled connection as desired. You can also use getInputStream() to read from the tunneled connection.

When you are doing using the connection, simply close both the input and output streams.

Parameters:
useTunneled - True if enabling tunneled streaming, false if not
Throws:
java.lang.IllegalStateException - - If the connection is already connected or a different streaming mode has been set.

getHeaderField

public java.lang.String getHeaderField(java.lang.String name)
See Also:
Before calling this, you must call either getResponseCode() or getInputStream() to read the response.

getHeaderFields

public java.util.Map getHeaderFields()
See Also:
Before calling this, you must call either getResponseCode() or getInputStream() to read the response.

getHeaderFieldKey

public java.lang.String getHeaderFieldKey(int keyPosition)
See Also:
Before calling this, you must call either getResponseCode() or getInputStream() to read the response.

getHeaderField

public java.lang.String getHeaderField(int position)
See Also:
Before calling this, you must call either getResponseCode() or getInputStream() to read the response.

getHeadersLength

public int getHeadersLength()
Returns the number of response headers. Before calling this, you must call either getResponseCode() or getInputStream() to read the response.


setCookieSupport

public void setCookieSupport(CookieContainer container,
                             java.lang.String policy)
Associates the given CookieContainer with this connection. This must be done before the request is connected. This will cause any cookies in the container to be sent with the request, and any cookies received from the server are stored in the container.

Parameters:
container - the container store/retrieve the cookies associated with this request, null if the request should not used cookies.
policy - the name of the CookiePolicy to use in processing cookies. -1 will use the default policy, if the container is not null.

setDefaultCookieSupport

public static void setDefaultCookieSupport(CookieContainer container,
                                           java.lang.String policy)

getCookieContainer

public CookieContainer getCookieContainer()
Returns the CookieContainer associated with this request.

Returns:
CookieContainer

getCookiePolicy

public java.lang.String getCookiePolicy()
Returns the CookiePolicy string associated with this request.

Returns:
an string identifying the cookie policy

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Gets an InputStream for the data returned in the response. You should not use getErrorStream() if you have called this, as this function returns the response even in the case of an error.

Throws:
java.io.IOException
See Also:
URLConnection.getInputStream()

getReader

public java.io.Reader getReader()
                         throws java.io.IOException
Gets a Reader for the data returned in the response. This will return whatever data is provided in the response, regardless of whether the request succeeded or not. This is an alternative to using getInputStream(), used if you want to read the data as character data instead of as bytes. The characters returned will be decoded according to the Content-Encoding and Content-Type headers in the response. If the charset of the response is not specified using a Content-Type header, then ISO-8859-1 is used, in accordance with the rules of RFC 2616 (3.7.1).

Throws:
java.io.IOException

getErrorStream

public java.io.InputStream getErrorStream()
Returns the data associated with the connection in the event of an error. This returns data only when the response code is >= 300. This should not be used if getInputStream() has already been called since that will have read the response.

See Also:
HttpURLConnection.getErrorStream()

disconnect

public void disconnect()
See Also:
HttpURLConnection.disconnect()

setDefaultUserAgent

public static void setDefaultUserAgent(HttpUserAgent userAgent)
Sets the default user agent.


getDefaultUserAgent

public static HttpUserAgent getDefaultUserAgent()
Gets the default user agent.


setUserAgent

public void setUserAgent(HttpUserAgent userAgent)
Sets the user agent for this connection.

Parameters:
userAgent - a object that implements the HttpUserAgent interface.
See Also:
HttpUserAgent

getUserAgent

public HttpUserAgent getUserAgent()
Sets the user agent for this connection.

Returns:
the user agent object.
See Also:
HttpUserAgent

getDoAuthentication

public boolean getDoAuthentication()
Automatic processing of responses where authentication is required (status codes 401 and 407).

Returns:
true if authentications will be processed automatically

setDoAuthentication

public void setDoAuthentication(boolean doAuthentication)
Automatic processing of responses where authentication is required (status codes 401 and 407).

The default is true.

Parameters:
doAuthentication - true to process authentications

getTimeout

public int getTimeout()
Deprecated. please use either getConnectionTimeout() or getRequestTimeout()

Return the timeout value associated with this connection.

Returns:
the timeout value in milliseconds.

setTimeout

public void setTimeout(int ms)
Set the timeout value associated with this connection. This is the number of milliseconds to wait for a connection to be established or a response to be received. If this is not specified the default timeout value is used. This is the same as calling setConnectTimeout() and setRequestTimeout() with the same value.

Parameters:
ms - milliseconds to wait for a connection or response.

getConnectionTimeout

public int getConnectionTimeout()
Return the connection timeout value associated with this connection.

Returns:
the timeout value in milliseconds.

setConnectionTimeout

public void setConnectionTimeout(int ms)
Set the connection timeout value associated with this connection. This is the number of milliseconds to wait for the socket connection to be established. If this is not specified the default connection timeout value is used.

Parameters:
ms - milliseconds to wait for the socket connection.

getRequestTimeout

public int getRequestTimeout()
Return the request timeout value associated with this connection.

Returns:
the timeout value in milliseconds.

setRequestTimeout

public void setRequestTimeout(int ms)
Set the request timeout value associated with this connection. This is the number of milliseconds to wait for a response after the request was sent. If this is not specified the default request timeout value is used.

Parameters:
ms - milliseconds to wait for the response.

getDefaultTimeout

public static int getDefaultTimeout()
Deprecated. please use getDefaultConnectionTimeout() or getDefaultRequestTimeout()

Return the default connection timeout value.

Returns:
the default timeout value in milliseconds.

setDefaultTimeout

public static void setDefaultTimeout(int ms)
Set the default timeout value. This is the number of milliseconds to wait for a connection to be established or a response to be received. Setting the value to 0 means no timeout is used, which is the default value for this property. This is equivalent to setting the com.oaklandsw.http.timeout property. This is the same as calling setDefaultConnectTimeout() and setDefaultRequestTimeout() with the same value.

Parameters:
ms - milliseconds to wait for a connection or response.

getDefaultConnectionTimeout

public static int getDefaultConnectionTimeout()
Return the default connection timeout value.

Returns:
the default timeout value in milliseconds.

setDefaultConnectionTimeout

public static void setDefaultConnectionTimeout(int ms)
Set the default connection timeout value. This is the number of milliseconds to wait for a connection to be established. Setting the value to 0 means no timeout is used, which is the default value for this property.

Parameters:
ms - milliseconds to wait for a socket connection.

getDefaultRequestTimeout

public static int getDefaultRequestTimeout()
Return the default request timeout value.

Returns:
the default timeout value in milliseconds.

setDefaultRequestTimeout

public static void setDefaultRequestTimeout(int ms)
Set the default request timeout value. This is the number of milliseconds to wait for a response to a request. Setting the value to 0 means no timeout is used, which is the default value for this property.

Parameters:
ms - milliseconds to wait for a response.

getIdleConnectionTimeout

public int getIdleConnectionTimeout()
Return the idle connection timeout value associated with this connection.

Returns:
the idle connection timeout value in milliseconds.

setIdleConnectionTimeout

public void setIdleConnectionTimeout(int ms)
Set the idle connection timeout value associated with this connection. This is the number of milliseconds to wait before closing an idle connection. Setting the value to 0 means idle connections are never automatically closed. If this is not specified the default idle connection timeout value is used.

Parameters:
ms - milliseconds to wait before closing an idle connection.

getDefaultIdleConnectionTimeout

public static int getDefaultIdleConnectionTimeout()
Return the default idle connection timeout value.

Returns:
the default idle connection timeout value in milliseconds.

setDefaultIdleConnectionTimeout

public static void setDefaultIdleConnectionTimeout(int ms)
Set the default idle connection timeout value. This is the number of milliseconds to wait before closing an idle connection. Setting the value to 0 means idle connections are never automatically closed. The default value for this is 14000 (14 seconds). This value was chosen to be slightly less than the default KeepAliveTimeout value for the Apache web server. This is equivalent to setting the com.oaklandsw.http.idleConnectionTimeout property.

Parameters:
ms - milliseconds to wait before closing an idle connection.

setDefaultIdleConnectionTimeout

public static void setDefaultIdleConnectionTimeout()
Set the default idle connection timeout value to its default value (14 seconds).


getIdleConnectionPing

public int getIdleConnectionPing()
Return the idle connection ping value associated with this connection.

Returns:
the idle connection ping value in milliseconds.

setIdleConnectionPing

public void setIdleConnectionPing(int ms)
Set the idle connection ping value associated with this connection. This is used to ping the connection before sending a POST request. The ping is issued if the connection was idle for at least the number of milliseconds specified. Setting the value to 0 means idle connections are never pinged before a POST request. If this is not specified the default idle connection ping value is used. In the event the ping fails, it is retried on a different connection. The number of tries is controlled by setTries().

Parameters:
ms - milliseconds to wait before pinging an idle connection.

getDefaultIdleConnectionPing

public static int getDefaultIdleConnectionPing()
Return the default idle connection ping value.

Returns:
the default idle connection ping value in milliseconds.

setDefaultIdleConnectionPing

public static void setDefaultIdleConnectionPing(int ms)
Set the default idle connection ping value. See setIdleConnectionPing(). This is equivalent to setting the com.oaklandsw.http.idleConnectionPing property.

Parameters:
ms - milliseconds to wait before pinging an idle connection.

setDefaultIdleConnectionPing

public static void setDefaultIdleConnectionPing()
Set the default idle connection ping value to its default value (0 seconds).


getConnectionRequestLimit

public int getConnectionRequestLimit()
Return the connection request limit value associated with this connection.

Returns:
the connection request limit value
See Also:
setConnectionRequestLimit(int)

setConnectionRequestLimit

public void setConnectionRequestLimit(int requests)
Sets the number of HttpURLConnection requests that can be used on the underlying socket connection. After this number is reached, the socket connection is closed.

This is useful in certain pipelining situations where the connection might be closed by the server after a certain number of requests. However, if the server closes a connection after a certain number of requests using a Connection-Close header, this fact is automatically noted and pipelining will not send more than that observed number of requests on a socket connection.

Parameters:
requests - number of requests allowed for each underlying socket connection

getDefaultConnectionRequestLimit

public static int getDefaultConnectionRequestLimit()
Return the default idle connection ping value.

Returns:
the default idle connection ping value.

setDefaultConnectionRequestLimit

public static void setDefaultConnectionRequestLimit(int requests)
Set the default idle connection request limit value. This is equivalent to setting the com.oaklandsw.http.connectionRequestLimit property.

Parameters:
requests - number of requests allowed for each underlying socket connection

setDefaultConnectionRequestLimit

public static void setDefaultConnectionRequestLimit()
Set the default idle connection ping value to its default value (0 seconds).


isExplicitClose

public static boolean isExplicitClose()
Deprecated.  

This returns true. All connections are assumed that they will get an input stream and close it if the connection succeeds.

Returns:
the value of the explicit close flag.

setExplicitClose

public static void setExplicitClose(boolean explicitClose)
Deprecated.  

This does nothing.

Parameters:
explicitClose - the value for explicit closing of the connection.

setMaxConnectionsPerHost

public static void setMaxConnectionsPerHost(int maxConnections)
Set the maximum number of connections allowed for a given host:port. Per RFC 2616 section 8.1.4, this value defaults to 2.

Note that this refers to the connections to the target host of the request, it does not refer to the maximum number of connections to a proxy server. The maximum number of connections to a proxy server is always unlimited.

Parameters:
maxConnections - a number of connections allowed for each host:port, specify -1 for an unlimited number of connections.

getMaxConnectionsPerHost

public static int getMaxConnectionsPerHost()
Get the maximum number of connections allowed for a given host:port.

Returns:
The maximum number of connections allowed for a given host:port.

setUse10KeepAlive

public static void setUse10KeepAlive(boolean use)
Set the option to include the HTTP 1.0 Keep-Alive headers in HTTP requests. The default is that they are not included.

Parameters:
use - true if HTTP 1.0 Keep-Alive headers are included

getUse10KeepAlive

public static boolean getUse10KeepAlive()
Get the option to include the HTTP 1.0 Keep-Alive headers in HTTP requests.

Returns:
true if HTTP 1.0 Keep-Alive headers are included

setTries

public static void setTries(int tries)
Deprecated. please use setDefaultMaxTries()

Set the number of times an idempotent request is to be tried before considering it a failure. This value defaults to 3. This also controls the number of times a ping message is set after failure when the idleConnectionPing is enabled. See setIdleConnectionPing().

Parameters:
tries - the number of times to try the request.

setDefaultMaxTries

public static void setDefaultMaxTries(int tries)
                               throws java.lang.IllegalArgumentException
Set the number of times an idempotent request is to be tried before considering it a failure. This value defaults to 3. This also controls the number of times a ping message is set after failure when the idleConnectionPing is enabled. See setIdleConnectionPing().

Parameters:
tries - the number of times to try the request.
Throws:
java.lang.IllegalArgumentException

getTries

public static int getTries()
Deprecated. please use getDefaultMaxTries()

Get the number of times an idempotent request is tried.

Returns:
The number of times to try the request.

getDefaultMaxTries

public static int getDefaultMaxTries()
Get the number of times an idempotent request is tried.

Returns:
The number of times to try the request.

setDefaultMaxForwards

public static void setDefaultMaxForwards(int forwards)
                                  throws java.lang.IllegalArgumentException
Set the number of times a request can be redirected or it can have its authentication retried in the event of an authentication failure (particularly in a pipelined environment). This value defaults to 100.

Parameters:
forwards - the number of times to redirect or retry authentication
Throws:
java.lang.IllegalArgumentException

getDefaultMaxForwards

public static int getDefaultMaxForwards()
Get the number of forwards and authentication retries allowed.

Returns:
The number of times to redirect or retry authentication.

setRetryInterval

public static void setRetryInterval(int ms)
Set the interval to wait before each retry of a failed request. This value defaults to 0 (milliseconds).

Parameters:
ms - the interval to wait in milliseconds.

getRetryInterval

public static int getRetryInterval()
Get the interval to wait before each retry of a failed request.

Returns:
The number of milliseconds to wait before retrying.

setPreemptiveAuthentication

public static void setPreemptiveAuthentication(boolean enabled)
Deprecated.  

Enable preemptive authentication for all connections.

This is by default disabled.

Parameters:
enabled - true if enabled

getPreemptiveAuthentication

public static boolean getPreemptiveAuthentication()
Deprecated.  

Get the value of preemptive authentication enablement for all connections.

Returns:
true if preemptive authentication is enabled.

setDefaultAuthenticationType

public static void setDefaultAuthenticationType(int type)
Sets the default authentication type.

The value of the authentication type is one of the values in the Credential class (NTLM, BASIC, DIGEST).

Parameters:
type - an integer, the default authentication type.
See Also:
setAuthenticationType(int)

getDefaultAuthenticationType

public static int getDefaultAuthenticationType()
Gets the default authentication type.

Returns:
an integer, the default authentication type.
See Also:
getAuthenticationType()

getAuthenticationType

public int getAuthenticationType()
Returns the authentication type associated with this connection.

Returns:
an integer, the authentication type
See Also:
setAuthenticationType(int)

setAuthenticationType

public void setAuthenticationType(int authenticationType)
Sets the authentication type for this connection used for pipelining or streaming.

When using pipelining with authentication, you must specify an authentication type. When using streaming with authentication, you may specify the authentication type to avoid a HttpRetryException. In either case, specifying an authentication type forces the authentication process to complete for the request (Basic or Digest) or connection (NTLM) before the pipelining or streaming starts.

Authentication behaves as follows:

Parameters:
authenticationType -
See Also:
setPipelining(boolean), setChunkedStreamingMode(int), setFixedLengthStreamingMode(int)

setDefaultProxyAuthenticationType

public static void setDefaultProxyAuthenticationType(int type)
Sets the default proxy authentication type.

The value of the authentication type is one of the values in the Credential class (NTLM, BASIC, DIGEST).

Parameters:
type - an integer, the default proxy authentication type.
See Also:
setProxyAuthenticationType(int)

getDefaultProxyAuthenticationType

public static int getDefaultProxyAuthenticationType()
Gets the default proxy authentication type.

Returns:
an integer, the default proxy authentication type.
See Also:
getProxyAuthenticationType()

getProxyAuthenticationType

public int getProxyAuthenticationType()
Returns the proxy authentication type associated with this connection.

Returns:
an integer, the proxy authentication type
See Also:
setProxyAuthenticationType(int)

setProxyAuthenticationType

public void setProxyAuthenticationType(int authenticationType)
Sets the proxy authentication type for this connection.

Same as setAuthenticationType, except for a proxy.

Parameters:
authenticationType -
See Also:
setAuthenticationType(int)

getAuthenticationDummyContent

public java.lang.String getAuthenticationDummyContent()
For internal use only (public for testing)


setAuthenticationDummyContent

public void setAuthenticationDummyContent(java.lang.String authenticationDummyContent)
For internal use only (public for testing)


getAuthenticationDummyMethod

public java.lang.String getAuthenticationDummyMethod()
For internal use only (public for testing)


setAuthenticationDummyMethod

public void setAuthenticationDummyMethod(java.lang.String authenticationDummyMethod)
For internal use only (public for testing)


setDefaultPipelining

public static void setDefaultPipelining(boolean enabled)
Enable pipelining for all connections. Pipelining allows multiple HTTP requests to be sent in a single underlying socket connection before a response is received. This can have a substantial performance benefit if you are fetching multiple objects from the same server.

This is by default disabled.

Parameters:
enabled - true if enabled

isDefaultPipelining

public static boolean isDefaultPipelining()
Get the value of pipelining enablement for all connections.

Returns:
true if pipelining is enabled.

setDefaultPipeliningOptions

public static void setDefaultPipeliningOptions(int pipeliningOptions)
Set specific pipeline options for all connections. This allows finer control of the pipelining behavior.

Parameters:
pipeliningOptions - - see the PIPE_ constants.

getDefaultPipeliningOptions

public static int getDefaultPipeliningOptions()
Get the value of pipelining options for all connections.

Returns:
an int, the options

setPipelining

public void setPipelining(boolean enabled)
Enable pipelining for this connection. Pipelining allows multiple HTTP requests to be sent in a single underlying socket connection before a response is received. This can have a substantial performance benefit if you are fetching multiple objects from the same server.

By default, the following pipeline options are set: PIPE_PIPELINE and PIPE_MAX_CONNECTIONS.

Parameters:
enabled - true if enabled for this connection

isPipelining

public boolean isPipelining()
Get the value of pipelining enablement for this connection.

Returns:
true if pipelining is enabled.

plOptionsToString

public static java.lang.String plOptionsToString(int options)
Returns a string representation of the specified pipelining options.

Parameters:
options -
Returns:
a String which is a text representation of the pipelining options.

setPipeliningOptions

public void setPipeliningOptions(int pipeliningOptions)
Set specific pipeline options for this connection. This allows finer control of the pipelining behavior.

Parameters:
pipeliningOptions - - see the PIPE_ constants.

getPipeliningOptions

public int getPipeliningOptions()
Get the value of pipelining options for this connection.

Returns:
an int, the options

setDefaultPipeliningMaxDepth

public static void setDefaultPipeliningMaxDepth(int pipeliningMaxDepth)
Sets the maximum depth of pipelining for all connections.

Parameters:
pipeliningMaxDepth - the maximum pipelining depth.
See Also:
setPipeliningMaxDepth(int)

getDefaultPipeliningMaxDepth

public static int getDefaultPipeliningMaxDepth()
Get the value of the maximum depth of pipelining for all connections.

Returns:
an int, the maximum pipelining depth.

setPipeliningMaxDepth

public void setPipeliningMaxDepth(int pipeliningMaxDepth)
Sets the maximum depth of pipelining for this connection.

The maximum depth is the number of outstanding HTTP requests that can be active at any one time on a socket connection. If this is 0 then there is no limit. Note that most of the time this is not necessary, as the pipelining mechanism automatically senses the maximum number of HTTP requests allowed on a socket connection before that connection is closed by the server and uses this as the maximum depth. See PIPE_USE_OBSERVED_CONN_LIMIT.

Parameters:
pipeliningMaxDepth - the maximum pipelining depth.

getPipeliningMaxDepth

public int getPipeliningMaxDepth()
Get the value of the maximum depth of pipelining for this connection.

Returns:
an int, the maximum pipelining depth.

setDefaultCallback

public static void setDefaultCallback(Callback cb)
Sets the Callback object for all connections. The specified Callback object will be used for any connection opened after this is set.

Callback objects are used to handle notifications related to pipelining or non-blocking I/O.

Parameters:
cb - a Callback object.

getDefaultCallback

public static Callback getDefaultCallback()
Returns the default Callback object.

Returns:
a callback object

setCallback

public void setCallback(Callback cb)
Sets the Callback object associated with this connection.

Callback objects are used to handle notifications related to pipelining or non-blocking I/O.

Parameters:
cb -

getCallback

public Callback getCallback()
Gets the Callback object associated with this connection.

Returns:
a Callback object

pipelineExecute

public void pipelineExecute()
                     throws java.lang.InterruptedException,
                            java.io.InterruptedIOException
Begins the pipelined execution of this connection. You may subsequently call pipelineBlock() to wait for all of the pipelined connections you have executed on this thread.

Throws:
java.lang.InterruptedException
java.io.InterruptedIOException

pipelineBlock

public static void pipelineBlock()
                          throws java.lang.InterruptedException
Blocks until all pipelined HttpURLConnections are completed on this thread.

Throws:
java.lang.InterruptedException

pipelineExecuteAsync

public void pipelineExecuteAsync()
                          throws java.lang.InterruptedException
Begins the pipelined execution of this connection, when you don't need to block for completion of the connection or if this thread cannot tolerate blocking.

This will never block for any reason; it moves the work of writing the HTTP request to another thread.

Throws:
java.lang.InterruptedException

setProxyHost

public static void setProxyHost(java.lang.String host)
Sets the host to be used as a proxy server.

Note that when this is called, all existing connections are closed, since the existing connections are no longer going to the desired destination.

Parameters:
host - the name of the host to be used as a proxy server.

getProxyHost

public static java.lang.String getProxyHost()
Returns the current value of the proxy server host.

Returns:
the proxy host.

setProxySsl

public static void setProxySsl(boolean ssl)
Enables or disables the use of SSL for the proxy for all connections.

Note that when this is called, all existing connections are closed, since the existing connections are no longer going to the desired destination.

Parameters:
ssl - true if the proxy is to use SSL.

isProxySsl

public static boolean isProxySsl()
Returns true if the proxy is to use SSL for all connections.

Returns:
true if the proxy is to use SSL.

setConnectionProxyHost

public void setConnectionProxyHost(java.lang.String host)
Sets the host to be used as a proxy server for this connection.

This must be called before the connection is connected.

Parameters:
host - the name of the host to be used as a proxy server.

getConnectionProxyHost

public java.lang.String getConnectionProxyHost()
Returns the current value of the proxy server host on this connection.

Returns:
the proxy host.

setConnectionProxySsl

public void setConnectionProxySsl(boolean ssl)
Enables or disables the use of SSL for the proxy.

This must be called before the connection is connected.

Parameters:
ssl - true if the proxy is to use SSL.

isConnectionProxySsl

public boolean isConnectionProxySsl()
Returns true if the proxy is to use SSL for this connection.

Returns:
true if the proxy is to use SSL.

setProxyPort

public static void setProxyPort(int port)
Sets the port on the proxy server host.

Note that when this is called, all existing connections are closed, since the existing connections are no longer going to the desired destination.

Parameters:
port - the port number of the proxy server.

getProxyPort

public static int getProxyPort()
Returns the current value of the proxy server port number.

Returns:
the proxy port.

setConnectionProxyPort

public void setConnectionProxyPort(int port)
Sets the port on the proxy server host.

This must be called before the connection is connected.

Parameters:
port - the port number of the proxy server.

getConnectionProxyPort

public int getConnectionProxyPort()
Returns the current value of the proxy server port number.

Returns:
the proxy port.

setProxyUser

public static void setProxyUser(java.lang.String user)
Sets the user to be used to authenticate with the proxy server. If the proxy authenticates with NTLM, this value specifies both the domain name and user name as follows: "domain\\user".

This is used only if no HTTPUserAgent is provided.

Parameters:
user - the name of the user to be used with the proxy server.

getProxyUser

public static java.lang.String getProxyUser()
Returns the current value of the proxy server user.

Returns:
the proxy user.

setConnectionProxyUser

public void setConnectionProxyUser(java.lang.String user)
Sets the user to be used to authenticate with the proxy server.

This is used only if no HTTPUserAgent is provided.

This must be called before the connection is connected.

Parameters:
user - the name of the host to be used as a proxy server.

getConnectionProxyUser

public java.lang.String getConnectionProxyUser()
Returns the current value of the proxy user on this connection.

Returns:
the proxy user.

setProxyPassword

public static void setProxyPassword(java.lang.String password)
Sets the password to be used to authenticate with the proxy server for this connection.

This is used only if no HTTPUserAgent is provided.

This must be called before the connection is connected.

Parameters:
password - the name of the password to be used with the proxy server.

getProxyPassword

public static java.lang.String getProxyPassword()
Returns the current value of the proxy password.

Returns:
the proxy password.

setConnectionProxyPassword

public void setConnectionProxyPassword(java.lang.String password)
Sets the password to be used to authenticate with the proxy server for this connection.

This is used only if no HTTPUserAgent is provided.

This must be called before the connection is connected.

Parameters:
password - the name of the host to be used as a proxy server.

getConnectionProxyPassword

public java.lang.String getConnectionProxyPassword()
Returns the current value of the proxy server password on this connection.

Returns:
the proxy password.

setNonProxyHosts

public static void setNonProxyHosts(java.lang.String hosts)
Sets the hosts to be excluded from the proxy mechanism. This applies to all connections whose proxy host is set using global means (that is with a System.property or the static setProxyHost(String) method. This does not apply if you set the proxy host on the connection directly using setConnectionProxyHost(String). This allows you to override the proxy setting for a connection without regard to the setting of the global non-proxy hosts.

Parameters:
hosts - a list of hosts separated by the pipe ("|") character. Each host is a string containing either a hostname or IP address. The "*" character may be used within this string to provide wildcarding.
See Also:
isNonProxyHost(String)

getNonProxyHosts

public static java.lang.String getNonProxyHosts()
Returns the current value of the hosts to not be accessed through the proxy server.

Returns:
the non-proxied hosts.

isNonProxyHost

public static boolean isNonProxyHost(java.lang.String hostName)
Returns true if the specified host is treated as a non-proxy host.

Returns:
true if the specified host is treated as a non-proxy host.

getMultiCredentialsPerAddress

public static boolean getMultiCredentialsPerAddress()
Allow multiple sets of authentication credentials per destination Internet address (host/port). By default this is true; multiple sets of credentials may be used required for a single internet address. In this case, the HttpUserAgent will be called more often to obtain these credentials and it will not be suitable to connect this directly to a UI (e.g. it will bug the user too much). Set this to false if you wish that each Internet address use a single set of credentials (user/password), and the HttpUserAgent is called only when necessary to obtain these credentials. This allows the HttpUserAgent to be directly hooked to a UI that asks the user only when necessary. This applies both to proxy connections and non-proxy connections.

Returns:
a boolean, if multiple sets of credentials are allowed.

setMultiCredentialsPerAddress

public static void setMultiCredentialsPerAddress(boolean multi)
Allow multiple sets of authentication credentials per destination Internet address (host/port). By default this is true; multiple sets of credentials may be used required for a single internet address. In this case, the HttpUserAgent will be called more often to obtain these credentials and it will not be suitable to connect this directly to a UI (e.g. it will bug the user too much). Set this to false if you wish that each Internet address use a single set of credentials (user/password), and the HttpUserAgent is called only when necessary to obtain these credentials. This allows the HttpUserAgent to be directly hooked to a UI that asks the user only when necessary. This applies both to proxy connections and non-proxy connections.

Parameters:
multi - true if multiple sets of credentials are allowed

resetCachedCredentials

public static void resetCachedCredentials()
Flushes all cached credentials.

Used only when getMulti[Proxy]CredentialsPerAddress is false as this is the only time the credentials are cached. Note that when getMulti[Proxy]CredentialsPerAddress is specified, there is no matching of the (proxy) credentials to the credentials on which the underlying socket connections were created. So if you reset the cache here and then use different credentials, any existing socket connections in the pool may be used with their original credentials. To avoid this, call closeAllPooledConnections().

See Also:
getMultiCredentialsPerAddress(), setMultiCredentialsPerAddress(boolean)

closeAllPooledConnections

public static void closeAllPooledConnections()
                                      throws java.lang.InterruptedException
Close all pooled connections that are not currently in use.

HTTP requests that are currently in progress will be allowed complete normally. The connections associated with those requests will be closed when the connections complete.

Throws:
java.lang.InterruptedException

immediateShutdown

public static void immediateShutdown()
                              throws java.lang.InterruptedException
Immediately close all connections and stop all work in progress.

Throws:
java.lang.InterruptedException

resetStatistics

public static void resetStatistics()
Resets the statistics counters.


dumpAll

public static java.lang.String dumpAll()

dumpAll

public static void dumpAll(java.io.PrintWriter out)

getConnectionPool

public static java.lang.String getConnectionPool()
Prints all pooled connections to System.out.


getStatistics

public static java.lang.String getStatistics()
Returns various statistics in printed form


getStaticConfiguration

public static java.lang.String getStaticConfiguration()

getCipherSuite

public java.lang.String getCipherSuite()
Returns the cipher suite associated with this connection.

Returns:
the Cipher Suite associated with the SSL connection.

getLocalCertificates

public java.security.cert.Certificate[] getLocalCertificates()
Returns the certificates(s) that were sent to the server when the connection was established. Note: this method does not work on implementations prior to 1.4.

Returns:
the local Certificates associated with the SSL connection
Since:
JDK 1.4

getServerCertificates

public java.security.cert.Certificate[] getServerCertificates()
                                                       throws javax.net.ssl.SSLPeerUnverifiedException
Returns the server's certificate chain that was established when the session was setup. Note: this method does not work on implementations prior to 1.4.

Returns:
the server Certificates associated with the SSL connection
Throws:
javax.net.ssl.SSLPeerUnverifiedException
Since:
JDK 1.4

getDefaultHostnameVerifier

public static HostnameVerifier getDefaultHostnameVerifier()
Returns the default hostname verifier used for SSL connections.

Returns:
the default hostname verifier associated with the SSL connection

setDefaultHostnameVerifier

public static void setDefaultHostnameVerifier(HostnameVerifier verifier)
Sets the default hostname verifier used for SSL connections


getHostnameVerifier

public HostnameVerifier getHostnameVerifier()
Returns the hostname verifier used for this SSL connection.

Returns:
the default hostname verifier associated with the SSL connection

setHostnameVerifier

public void setHostnameVerifier(HostnameVerifier verifier)
Sets the hostname verifier used for this SSL connection


getDefaultSSLSocketFactory

public static javax.net.ssl.SSLSocketFactory getDefaultSSLSocketFactory()
Returns the default SSL socket factory used for SSL connections.


setDefaultSSLSocketFactory

public static void setDefaultSSLSocketFactory(javax.net.ssl.SSLSocketFactory factory)
Sets the default SSL socket factory used for SSL connections.


getSSLSocketFactory

public javax.net.ssl.SSLSocketFactory getSSLSocketFactory()
Returns the SSL socket factory used this SSL connection.


setSSLSocketFactory

public void setSSLSocketFactory(javax.net.ssl.SSLSocketFactory factory)
Sets the SSL socket factory used for this SSL connection.


isForceSSL

public boolean isForceSSL()
Gets the value indicating if SSL is forced for this URL connection.


setForceSSL

public void setForceSSL(boolean forceSSL)
Forces the URL connection to use SSL regardless of the protocol specified. If this is not set, the SSL is used only if the HTTPS protocol is specified. This is used to work with the FTP protocol using a proxy.


isDefaultForceSSL

public static boolean isDefaultForceSSL()
Gets the value indicating if SSL is forced for this all URL connections.


setDefaultForceSSL

public static void setDefaultForceSSL(boolean forceSSL)
Forces the URL connection to use SSL regardless of the protocol specified for all connections. If this is not set, the SSL is used only if the HTTPS protocol is specified. This is used to work with the FTP protocol using a proxy.


getDefaultSocketFactory

public static AbstractSocketFactory getDefaultSocketFactory()
Returns the default socket factory used for HTTP socket connections.


setDefaultSocketFactory

public static void setDefaultSocketFactory(AbstractSocketFactory factory)
Sets the default socket factory used for HTTP socket connections.


getSocketFactory

public AbstractSocketFactory getSocketFactory()
Returns the socket factory used for this HTTP socket connection.


setSocketFactory

public void setSocketFactory(AbstractSocketFactory factory)
Sets the default socket factory used for this HTTP socket connection.


setSocketBufferSize

public static void setSocketBufferSize(int type,
                                       int size)
Sets the buffer size to be used for the underlying sockets for all connections.

Parameters:
type - specify either SOCKET_READ or SOCKET_WRITE.
size - the buffer size in bytes. Specify -1 to use the default system setting for the buffer size. The defaults are found in the constants DEFAULT_SEND_BUFFER_SIZE and DEFAULT_RECEIVE_BUFFER_SIZE.

getSocketBufferSize

public static int getSocketBufferSize(int type)
Gets the buffer size to be used for the underlying sockets for all connections.

Parameters:
type - specify either SOCKET_READ or SOCKET_WRITE.
Returns:
the buffer size in bytes.

setNtlmPreferredEncoding

public static void setNtlmPreferredEncoding(int encoding)
Sets the preferred encoding for NTLM authenticate messages. By default the preferred encoding is Unicode, this method can be used to override that. The preferred encoding is sent only if it is an allowed encoding as indicated by the challenge message.


getNtlmPreferredEncoding

public static int getNtlmPreferredEncoding()
Gets the preferred encoding for NTLM messages.

Returns:
an int, the preferred encoding.

setMethodProperties

public static void setMethodProperties(java.lang.String methodName,
                                       int properties)
Sets the properties for the specified method to the specified property value.

Parameters:
methodName - the name of the method, like GET or POST
properties - the property value which is one or more (union) of the constants beginning METHOD_PROP_

setDefaultThrowFileNotFoundOn404

public static void setDefaultThrowFileNotFoundOn404(boolean doThrow)
For JRE compatibility throw a FileNotFoundException when a 404 response is detected. By default this is off, that is the 404 response is passed through, which is not compatible with the JRE.

Parameters:
doThrow - true if a FileNotFoundException is to be thrown.

getDefaultThrowFileNotFoundOn404

public static boolean getDefaultThrowFileNotFoundOn404()
For JRE compatibility throw a FileNotFoundException when a 404 response is detected. By default this is off, that is the 404 response is passed through, which is not compatible with the JRE.

Returns:
true if a FileNotFoundException is to be thrown.

getUrlString

public java.lang.String getUrlString()

toString

public java.lang.String toString()

resetUrlConReleased

public static void resetUrlConReleased()

resetGlobalState

public static void resetGlobalState()
Resets the global persistent state. This is the state set by all of the setDefaultxxx() methods as well as that set by the System.setProperty() methods.



Copyright © 2002-2007 Oakland Software Incorporated. All Rights Reserved.