All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class java.net.HttpURLConnection

java.lang.Object
   |
   +----java.net.URLConnection
           |
           +----java.net.HttpURLConnection

public abstract class HttpURLConnection
extends URLConnection
A URLConnection with support for HTTP-specific features. See the spec for details.


Variable Index

 o HTTP_ACCEPTED
 o HTTP_BAD_GATEWAY
 o HTTP_BAD_METHOD
 o HTTP_BAD_REQUEST
4XX: client error
 o HTTP_CLIENT_TIMEOUT
 o HTTP_CONFLICT
 o HTTP_CREATED
 o HTTP_ENTITY_TOO_LARGE
 o HTTP_FORBIDDEN
 o HTTP_GATEWAY_TIMEOUT
 o HTTP_GONE
 o HTTP_INTERNAL_ERROR
 o HTTP_LENGTH_REQUIRED
 o HTTP_MOVED_PERM
 o HTTP_MOVED_TEMP
 o HTTP_MULT_CHOICE
3XX: relocation/redirect
 o HTTP_NO_CONTENT
 o HTTP_NOT_ACCEPTABLE
 o HTTP_NOT_AUTHORITATIVE
 o HTTP_NOT_FOUND
 o HTTP_NOT_MODIFIED
 o HTTP_OK
2XX: generally "OK"
 o HTTP_PARTIAL
 o HTTP_PAYMENT_REQUIRED
 o HTTP_PRECON_FAILED
 o HTTP_PROXY_AUTH
 o HTTP_REQ_TOO_LONG
 o HTTP_RESET
 o HTTP_SEE_OTHER
 o HTTP_SERVER_ERROR
5XX: server error
 o HTTP_UNAUTHORIZED
 o HTTP_UNAVAILABLE
 o HTTP_UNSUPPORTED_TYPE
 o HTTP_USE_PROXY
 o HTTP_VERSION
 o method
 o responseCode
 o responseMessage

Constructor Index

 o HttpURLConnection(URL)
Constructor for the URLStreamHandler.

Method Index

 o disconnect()
Close the connection to the server.
 o getFollowRedirects()
 o getRequestMethod()
Get the request method.
 o getResponseCode()
Gets HTTP response status.
 o getResponseMessage()
Gets the HTTP response message, if any, returned along with the response code from a server.
 o setFollowRedirects(boolean)
Sets whether HTTP redirects (requests with response code 3xx) should be automatically followed by this class.
 o setRequestMethod(String)
Set the method for the URL request, one of: are legal, subject to protocol restrictions.
 o usingProxy()
Indicates if the connection is going through a proxy.

Variables

 o method
 protected String method
 o responseCode
 protected int responseCode
 o responseMessage
 protected String responseMessage
 o HTTP_OK
 public static final int HTTP_OK
2XX: generally "OK"

 o HTTP_CREATED
 public static final int HTTP_CREATED
 o HTTP_ACCEPTED
 public static final int HTTP_ACCEPTED
 o HTTP_NOT_AUTHORITATIVE
 public static final int HTTP_NOT_AUTHORITATIVE
 o HTTP_NO_CONTENT
 public static final int HTTP_NO_CONTENT
 o HTTP_RESET
 public static final int HTTP_RESET
 o HTTP_PARTIAL
 public static final int HTTP_PARTIAL
 o HTTP_MULT_CHOICE
 public static final int HTTP_MULT_CHOICE
3XX: relocation/redirect

 o HTTP_MOVED_PERM
 public static final int HTTP_MOVED_PERM
 o HTTP_MOVED_TEMP
 public static final int HTTP_MOVED_TEMP
 o HTTP_SEE_OTHER
 public static final int HTTP_SEE_OTHER
 o HTTP_NOT_MODIFIED
 public static final int HTTP_NOT_MODIFIED
 o HTTP_USE_PROXY
 public static final int HTTP_USE_PROXY
 o HTTP_BAD_REQUEST
 public static final int HTTP_BAD_REQUEST
4XX: client error

 o HTTP_UNAUTHORIZED
 public static final int HTTP_UNAUTHORIZED
 o HTTP_PAYMENT_REQUIRED
 public static final int HTTP_PAYMENT_REQUIRED
 o HTTP_FORBIDDEN
 public static final int HTTP_FORBIDDEN
 o HTTP_NOT_FOUND
 public static final int HTTP_NOT_FOUND
 o HTTP_BAD_METHOD
 public static final int HTTP_BAD_METHOD
 o HTTP_NOT_ACCEPTABLE
 public static final int HTTP_NOT_ACCEPTABLE
 o HTTP_PROXY_AUTH
 public static final int HTTP_PROXY_AUTH
 o HTTP_CLIENT_TIMEOUT
 public static final int HTTP_CLIENT_TIMEOUT
 o HTTP_CONFLICT
 public static final int HTTP_CONFLICT
 o HTTP_GONE
 public static final int HTTP_GONE
 o HTTP_LENGTH_REQUIRED
 public static final int HTTP_LENGTH_REQUIRED
 o HTTP_PRECON_FAILED
 public static final int HTTP_PRECON_FAILED
 o HTTP_ENTITY_TOO_LARGE
 public static final int HTTP_ENTITY_TOO_LARGE
 o HTTP_REQ_TOO_LONG
 public static final int HTTP_REQ_TOO_LONG
 o HTTP_UNSUPPORTED_TYPE
 public static final int HTTP_UNSUPPORTED_TYPE
 o HTTP_SERVER_ERROR
 public static final int HTTP_SERVER_ERROR
5XX: server error

 o HTTP_INTERNAL_ERROR
 public static final int HTTP_INTERNAL_ERROR
 o HTTP_BAD_GATEWAY
 public static final int HTTP_BAD_GATEWAY
 o HTTP_UNAVAILABLE
 public static final int HTTP_UNAVAILABLE
 o HTTP_GATEWAY_TIMEOUT
 public static final int HTTP_GATEWAY_TIMEOUT
 o HTTP_VERSION
 public static final int HTTP_VERSION

Constructors

 o HttpURLConnection
 protected HttpURLConnection(URL u)
Constructor for the URLStreamHandler.

Methods

 o setFollowRedirects
 public static void setFollowRedirects(boolean set)
Sets whether HTTP redirects (requests with response code 3xx) should be automatically followed by this class. True by default. Applets cannot change this variable.

 o getFollowRedirects
 public static boolean getFollowRedirects()
 o setRequestMethod
 public void setRequestMethod(String method) throws ProtocolException
Set the method for the URL request, one of: are legal, subject to protocol restrictions. The default method is GET.

Throws: ProtocolException
if the method cannot be reset or if the requested method isn't valid for HTTP.
 o getRequestMethod
 public String getRequestMethod()
Get the request method.

 o getResponseCode
 public int getResponseCode() throws IOException
Gets HTTP response status. From responses like:
 HTTP/1.0 200 OK
 HTTP/1.0 401 Unauthorized
 
Extracts the ints 200 and 401 respectively. Returns -1 if none can be discerned from the response (i.e., the response is not valid HTTP).

 o getResponseMessage
 public String getResponseMessage() throws IOException
Gets the HTTP response message, if any, returned along with the response code from a server. From responses like:
 HTTP/1.0 200 OK
 HTTP/1.0 404 Not Found
 
Extracts the Strings "OK" and "Not Found" respectively. Returns null if none could be discerned from the responses (the result was not valid HTTP).

 o disconnect
 public abstract void disconnect()
Close the connection to the server.

 o usingProxy
 public abstract boolean usingProxy()
Indicates if the connection is going through a proxy.


All Packages  Class Hierarchy  This Package  Previous  Next  Index

Submit a bug or feature