Oracle Fusion Middleware
Oracle WebLogic Server API Reference
11g Release 1 (10.3.6)

Part Number E13941-06

weblogic.net.http
Class HttpURLConnection

java.lang.Object
  extended by java.net.URLConnection
      extended by java.net.HttpURLConnection
          extended by weblogic.net.http.HttpURLConnection
Direct Known Subclasses:
HttpsURLConnection, SOAPHttpURLConnection

public class HttpURLConnection
extends HttpURLConnection

A class to represent an HTTP connection to a remote object.


Field Summary
protected static int defaultConnectTimeout
           
protected  boolean ignoreSystemNonPorxyHosts
           
protected  IOException rememberedException
           
 
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, instanceFollowRedirects, method, responseCode, responseMessage
 
Fields inherited from class java.net.URLConnection
allowUserInteraction, connected, doInput, doOutput, ifModifiedSince, url, useCaches
 
Constructor Summary
HttpURLConnection(URL u)
           
HttpURLConnection(URL u, Proxy p)
           
 
Method Summary
 void addRequestProperty(String key, String value)
          Adds a general request property specified by a key-value pair.
 void connect()
           
 void disconnect()
          Disconnect from the server.
protected  void doSetRequests()
           
protected  boolean followRedirect()
           
static String getAuthInfo(String host, int port, String header)
           
 int getConnectTimeout()
           
 InputStream getErrorStream()
           
 String getHeaderField(int n)
          Gets a header field by index.
 String getHeaderField(String name)
          Gets a header field by name.
 String getHeaderFieldKey(int n)
          Gets a header field by index.
 Map getHeaderFields()
          Gets all header fields.
protected  weblogic.net.http.HttpClient getHttpClient()
           
 InputStream getInputStream()
           
 OutputStream getOutputStream()
           
protected  String getProtocol()
           
protected static String getProxyAuthString()
           
 int getReadTimeout()
           
 Map getRequestProperties()
           
 String getRequestProperty(String key)
           
 int getResponseCode()
           
 SocketFactory getSocketFactory()
          Gets the SocketFactory to be used when creating sockets for http URL connections.
 int getTimeout()
          Deprecated. since 9.0. Use getReadTimeout() instead
 void setChunkedStreamingMode(int chunkLength)
           
 void setConnectTimeout(int i)
           
static void setDefaultSocketFactory(SocketFactory nuDefaultSF)
          Sets the default SocketFactory to be used when creating sockets for http URL connections.
 void setEmptyRequestProperty(String key)
           
 void setFixedLengthStreamingMode(int fixedContentLength)
           
 void setIgnoreSystemNonPorxyHosts(boolean v)
          This method will permit the current connection ignore the system property http.nonProxyHosts Note: this method only takes effect calling before the connect() method
 void setMuxableSocket(Object socket)
           
 void setReadTimeout(int i)
           
 void setRequestMethod(String method)
           
 void setRequestProperty(String key, String value)
           
 void setSocketFactory(SocketFactory fact)
          Sets the SocketFactory to be used when creating sockets for http URL connections.
 void setTimeout(int i)
          Deprecated. since 9.0. Use setReadTimeout(int) instead
 boolean usingProxy()
           
protected  void writeRequests()
           
 
Methods inherited from class java.net.HttpURLConnection
getFollowRedirects, getHeaderFieldDate, getInstanceFollowRedirects, getPermission, getRequestMethod, getResponseMessage, setFollowRedirects, setInstanceFollowRedirects
 
Methods inherited from class java.net.URLConnection
getAllowUserInteraction, getContent, getContent, getContentEncoding, getContentLength, getContentType, getDate, getDefaultAllowUserInteraction, getDefaultRequestProperty, getDefaultUseCaches, getDoInput, getDoOutput, getExpiration, getFileNameMap, getHeaderFieldInt, getIfModifiedSince, getLastModified, getURL, getUseCaches, guessContentTypeFromName, guessContentTypeFromStream, setAllowUserInteraction, setContentHandlerFactory, setDefaultAllowUserInteraction, setDefaultRequestProperty, setDefaultUseCaches, setDoInput, setDoOutput, setFileNameMap, setIfModifiedSince, setUseCaches, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

defaultConnectTimeout

protected static int defaultConnectTimeout

rememberedException

protected IOException rememberedException

ignoreSystemNonPorxyHosts

protected boolean ignoreSystemNonPorxyHosts
Constructor Detail

HttpURLConnection

public HttpURLConnection(URL u)

HttpURLConnection

public HttpURLConnection(URL u,
                         Proxy p)
Method Detail

getProtocol

protected String getProtocol()

setSocketFactory

public final void setSocketFactory(SocketFactory fact)
Sets the SocketFactory to be used when creating sockets for http URL connections.


getSocketFactory

public final SocketFactory getSocketFactory()
Gets the SocketFactory to be used when creating sockets for http URL connections.


setDefaultSocketFactory

public static void setDefaultSocketFactory(SocketFactory nuDefaultSF)
Sets the default SocketFactory to be used when creating sockets for http URL connections. This is used in environments where an appropriate default SocketFactory type may be required

Parameters:
nuDefaultSF - SocketFactory to be used as a default SocketFactory

writeRequests

protected void writeRequests()
                      throws IOException
Throws:
IOException

setIgnoreSystemNonPorxyHosts

public void setIgnoreSystemNonPorxyHosts(boolean v)
This method will permit the current connection ignore the system property http.nonProxyHosts Note: this method only takes effect calling before the connect() method

Parameters:
v -

connect

public void connect()
             throws IOException
Specified by:
connect in class URLConnection
Throws:
IOException

getHttpClient

protected weblogic.net.http.HttpClient getHttpClient()
                                              throws IOException
Throws:
IOException

getOutputStream

public OutputStream getOutputStream()
                             throws IOException
Overrides:
getOutputStream in class URLConnection
Throws:
IOException

getProxyAuthString

protected static String getProxyAuthString()

getAuthInfo

public static String getAuthInfo(String host,
                                 int port,
                                 String header)
                          throws IOException
Throws:
IOException

getInputStream

public InputStream getInputStream()
                           throws IOException
Overrides:
getInputStream in class URLConnection
Throws:
IOException

getErrorStream

public InputStream getErrorStream()
Overrides:
getErrorStream in class HttpURLConnection

followRedirect

protected boolean followRedirect()
                          throws IOException
Throws:
IOException

disconnect

public void disconnect()
Disconnect from the server.

Specified by:
disconnect in class HttpURLConnection

usingProxy

public boolean usingProxy()
Specified by:
usingProxy in class HttpURLConnection

getHeaderField

public String getHeaderField(String name)
Gets a header field by name. Returns null if not known.

Overrides:
getHeaderField in class URLConnection
Parameters:
name - the name of the header field

getHeaderField

public String getHeaderField(int n)
Gets a header field by index. Returns null if not known.

Overrides:
getHeaderField in class HttpURLConnection
Parameters:
n - the index of the header field

getHeaderFields

public Map getHeaderFields()
Gets all header fields.

Overrides:
getHeaderFields in class URLConnection

getHeaderFieldKey

public String getHeaderFieldKey(int n)
Gets a header field by index. Returns null if not known.

Overrides:
getHeaderFieldKey in class HttpURLConnection
Parameters:
n - the index of the header field

addRequestProperty

public void addRequestProperty(String key,
                               String value)
Adds a general request property specified by a key-value pair. This method will not overwrite existing values associated with the same key.

Overrides:
addRequestProperty in class URLConnection
Parameters:
key - - request header name
value - - request header value

getRequestProperties

public Map getRequestProperties()
Overrides:
getRequestProperties in class URLConnection
Returns:
a Map of the general request properties for this connection.

setRequestProperty

public void setRequestProperty(String key,
                               String value)
Overrides:
setRequestProperty in class URLConnection

setEmptyRequestProperty

public void setEmptyRequestProperty(String key)

getRequestProperty

public String getRequestProperty(String key)
Overrides:
getRequestProperty in class URLConnection

doSetRequests

protected void doSetRequests()

setTimeout

public void setTimeout(int i)
Deprecated. since 9.0. Use setReadTimeout(int) instead

Sets the read timeout on this connection.

Parameters:
i - in milliseconds

getTimeout

public int getTimeout()
Deprecated. since 9.0. Use getReadTimeout() instead

Get the read timeout value for this connection

Returns:
the timeout value in milliseconds

setReadTimeout

public void setReadTimeout(int i)
Overrides:
setReadTimeout in class URLConnection

getReadTimeout

public int getReadTimeout()
Overrides:
getReadTimeout in class URLConnection

setConnectTimeout

public void setConnectTimeout(int i)
Overrides:
setConnectTimeout in class URLConnection

getConnectTimeout

public int getConnectTimeout()
Overrides:
getConnectTimeout in class URLConnection

setFixedLengthStreamingMode

public void setFixedLengthStreamingMode(int fixedContentLength)
Overrides:
setFixedLengthStreamingMode in class HttpURLConnection

setChunkedStreamingMode

public void setChunkedStreamingMode(int chunkLength)
Overrides:
setChunkedStreamingMode in class HttpURLConnection

getResponseCode

public int getResponseCode()
                    throws IOException
Overrides:
getResponseCode in class HttpURLConnection
Throws:
IOException

setMuxableSocket

public void setMuxableSocket(Object socket)

setRequestMethod

public void setRequestMethod(String method)
                      throws ProtocolException
Overrides:
setRequestMethod in class HttpURLConnection
Throws:
ProtocolException

Copyright 1996, 2011, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.

Oracle Fusion Middleware
Oracle WebLogic Server API Reference
11g Release 1 (10.3.6)

Part Number E13941-06