All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class java.net.HttpURLConnection

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

public 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
Properties Inheritable 
    method=String 
 o responseCode
Properties Inheritable 
   responseCode=int 
 o responseMessage
Properties Inheritable 
    responseMessage=String 
 o HTTP_OK
Properties Public Constant 
   HTTP_OK=int 
2XX: generally "OK"

 o HTTP_CREATED
Properties Public Constant 
   HTTP_CREATED=int 
 o HTTP_ACCEPTED
Properties Public Constant 
   HTTP_ACCEPTED=int 
 o HTTP_NOT_AUTHORITATIVE
Properties Public Constant 
   HTTP_NOT_AUTHORITATIVE=int 
 o HTTP_NO_CONTENT
Properties Public Constant 
   HTTP_NO_CONTENT=int 
 o HTTP_RESET
Properties Public Constant 
   HTTP_RESET=int 
 o HTTP_PARTIAL
Properties Public Constant 
   HTTP_PARTIAL=int 
 o HTTP_MULT_CHOICE
Properties Public Constant 
   HTTP_MULT_CHOICE=int 
3XX: relocation/redirect

 o HTTP_MOVED_PERM
Properties Public Constant 
   HTTP_MOVED_PERM=int 
 o HTTP_MOVED_TEMP
Properties Public Constant 
   HTTP_MOVED_TEMP=int 
 o HTTP_SEE_OTHER
Properties Public Constant 
   HTTP_SEE_OTHER=int 
 o HTTP_NOT_MODIFIED
Properties Public Constant 
   HTTP_NOT_MODIFIED=int 
 o HTTP_USE_PROXY
Properties Public Constant 
   HTTP_USE_PROXY=int 
 o HTTP_BAD_REQUEST
Properties Public Constant 
   HTTP_BAD_REQUEST=int 
4XX: client error

 o HTTP_UNAUTHORIZED
Properties Public Constant 
   HTTP_UNAUTHORIZED=int 
 o HTTP_PAYMENT_REQUIRED
Properties Public Constant 
   HTTP_PAYMENT_REQUIRED=int 
 o HTTP_FORBIDDEN
Properties Public Constant 
   HTTP_FORBIDDEN=int 
 o HTTP_NOT_FOUND
Properties Public Constant 
   HTTP_NOT_FOUND=int 
 o HTTP_BAD_METHOD
Properties Public Constant 
   HTTP_BAD_METHOD=int 
 o HTTP_NOT_ACCEPTABLE
Properties Public Constant 
   HTTP_NOT_ACCEPTABLE=int 
 o HTTP_PROXY_AUTH
Properties Public Constant 
   HTTP_PROXY_AUTH=int 
 o HTTP_CLIENT_TIMEOUT
Properties Public Constant 
   HTTP_CLIENT_TIMEOUT=int 
 o HTTP_CONFLICT
Properties Public Constant 
   HTTP_CONFLICT=int 
 o HTTP_GONE
Properties Public Constant 
   HTTP_GONE=int 
 o HTTP_LENGTH_REQUIRED
Properties Public Constant 
   HTTP_LENGTH_REQUIRED=int 
 o HTTP_PRECON_FAILED
Properties Public Constant 
   HTTP_PRECON_FAILED=int 
 o HTTP_ENTITY_TOO_LARGE
Properties Public Constant 
   HTTP_ENTITY_TOO_LARGE=int 
 o HTTP_REQ_TOO_LONG
Properties Public Constant 
   HTTP_REQ_TOO_LONG=int 
 o HTTP_UNSUPPORTED_TYPE
Properties Public Constant 
   HTTP_UNSUPPORTED_TYPE=int 
 o HTTP_SERVER_ERROR
Properties Public Constant 
   HTTP_SERVER_ERROR=int 
5XX: server error

 o HTTP_INTERNAL_ERROR
Properties Public Constant 
   HTTP_INTERNAL_ERROR=int 
 o HTTP_BAD_GATEWAY
Properties Public Constant 
   HTTP_BAD_GATEWAY=int 
 o HTTP_UNAVAILABLE
Properties Public Constant 
   HTTP_UNAVAILABLE=int 
 o HTTP_GATEWAY_TIMEOUT
Properties Public Constant 
   HTTP_GATEWAY_TIMEOUT=int 
 o HTTP_VERSION
Properties Public Constant 
   HTTP_VERSION=int 

Constructors

 o HttpURLConnection
    method HttpURLConnection(u=URL) Inheritable 
Constructor for the URLStreamHandler.

Methods

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

 o getFollowRedirects
    method getFollowRedirects() returns boolean public  static   
 o setRequestMethod
    method setRequestMethod(method=String)  public     Signals 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
    method getRequestMethod() returns String public     
Get the request method.

 o getResponseCode
    method getResponseCode() returns int public     Signals 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
    method getResponseMessage() returns String public     Signals 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
    method disconnect()  public abstract    
Close the connection to the server.

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


All Packages  Class Hierarchy  This Package  Previous  Next  Index