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.
-
HTTP_ACCEPTED
-
-
HTTP_BAD_GATEWAY
-
-
HTTP_BAD_METHOD
-
-
HTTP_BAD_REQUEST
- 4XX: client error
-
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
- 3XX: relocation/redirect
-
HTTP_NO_CONTENT
-
-
HTTP_NOT_ACCEPTABLE
-
-
HTTP_NOT_AUTHORITATIVE
-
-
HTTP_NOT_FOUND
-
-
HTTP_NOT_MODIFIED
-
-
HTTP_OK
- 2XX: generally "OK"
-
HTTP_PARTIAL
-
-
HTTP_PAYMENT_REQUIRED
-
-
HTTP_PRECON_FAILED
-
-
HTTP_PROXY_AUTH
-
-
HTTP_REQ_TOO_LONG
-
-
HTTP_RESET
-
-
HTTP_SEE_OTHER
-
-
HTTP_SERVER_ERROR
- 5XX: server error
-
HTTP_UNAUTHORIZED
-
-
HTTP_UNAVAILABLE
-
-
HTTP_UNSUPPORTED_TYPE
-
-
HTTP_USE_PROXY
-
-
HTTP_VERSION
-
-
method
-
-
responseCode
-
-
responseMessage
-
-
HttpURLConnection(URL)
- Constructor for the URLStreamHandler.
-
disconnect()
- Close the connection to the server.
-
getFollowRedirects()
-
-
getRequestMethod()
- Get the request method.
-
getResponseCode()
- Gets HTTP response status.
-
getResponseMessage()
- Gets the HTTP response message, if any, returned along with the
response code from a server.
-
setFollowRedirects(boolean)
- Sets whether HTTP redirects (requests with response code 3xx) should
be automatically followed by this class.
-
setRequestMethod(String)
- Set the method for the URL request, one of:
- GET
- POST
- HEAD
- OPTIONS
- PUT
- DELETE
- TRACE
are legal, subject to protocol restrictions.
-
usingProxy()
- Indicates if the connection is going through a proxy.
method
Properties Inheritable
method=String
responseCode
Properties Inheritable
responseCode=int
responseMessage
Properties Inheritable
responseMessage=String
HTTP_OK
Properties Public Constant
HTTP_OK=int
- 2XX: generally "OK"
HTTP_CREATED
Properties Public Constant
HTTP_CREATED=int
HTTP_ACCEPTED
Properties Public Constant
HTTP_ACCEPTED=int
HTTP_NOT_AUTHORITATIVE
Properties Public Constant
HTTP_NOT_AUTHORITATIVE=int
HTTP_NO_CONTENT
Properties Public Constant
HTTP_NO_CONTENT=int
HTTP_RESET
Properties Public Constant
HTTP_RESET=int
HTTP_PARTIAL
Properties Public Constant
HTTP_PARTIAL=int
HTTP_MULT_CHOICE
Properties Public Constant
HTTP_MULT_CHOICE=int
- 3XX: relocation/redirect
HTTP_MOVED_PERM
Properties Public Constant
HTTP_MOVED_PERM=int
HTTP_MOVED_TEMP
Properties Public Constant
HTTP_MOVED_TEMP=int
HTTP_SEE_OTHER
Properties Public Constant
HTTP_SEE_OTHER=int
HTTP_NOT_MODIFIED
Properties Public Constant
HTTP_NOT_MODIFIED=int
HTTP_USE_PROXY
Properties Public Constant
HTTP_USE_PROXY=int
HTTP_BAD_REQUEST
Properties Public Constant
HTTP_BAD_REQUEST=int
- 4XX: client error
HTTP_UNAUTHORIZED
Properties Public Constant
HTTP_UNAUTHORIZED=int
HTTP_PAYMENT_REQUIRED
Properties Public Constant
HTTP_PAYMENT_REQUIRED=int
HTTP_FORBIDDEN
Properties Public Constant
HTTP_FORBIDDEN=int
HTTP_NOT_FOUND
Properties Public Constant
HTTP_NOT_FOUND=int
HTTP_BAD_METHOD
Properties Public Constant
HTTP_BAD_METHOD=int
HTTP_NOT_ACCEPTABLE
Properties Public Constant
HTTP_NOT_ACCEPTABLE=int
HTTP_PROXY_AUTH
Properties Public Constant
HTTP_PROXY_AUTH=int
HTTP_CLIENT_TIMEOUT
Properties Public Constant
HTTP_CLIENT_TIMEOUT=int
HTTP_CONFLICT
Properties Public Constant
HTTP_CONFLICT=int
HTTP_GONE
Properties Public Constant
HTTP_GONE=int
HTTP_LENGTH_REQUIRED
Properties Public Constant
HTTP_LENGTH_REQUIRED=int
HTTP_PRECON_FAILED
Properties Public Constant
HTTP_PRECON_FAILED=int
HTTP_ENTITY_TOO_LARGE
Properties Public Constant
HTTP_ENTITY_TOO_LARGE=int
HTTP_REQ_TOO_LONG
Properties Public Constant
HTTP_REQ_TOO_LONG=int
HTTP_UNSUPPORTED_TYPE
Properties Public Constant
HTTP_UNSUPPORTED_TYPE=int
HTTP_SERVER_ERROR
Properties Public Constant
HTTP_SERVER_ERROR=int
- 5XX: server error
HTTP_INTERNAL_ERROR
Properties Public Constant
HTTP_INTERNAL_ERROR=int
HTTP_BAD_GATEWAY
Properties Public Constant
HTTP_BAD_GATEWAY=int
HTTP_UNAVAILABLE
Properties Public Constant
HTTP_UNAVAILABLE=int
HTTP_GATEWAY_TIMEOUT
Properties Public Constant
HTTP_GATEWAY_TIMEOUT=int
HTTP_VERSION
Properties Public Constant
HTTP_VERSION=int
HttpURLConnection
method HttpURLConnection(u=URL) Inheritable
- Constructor for the URLStreamHandler.
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.
getFollowRedirects
method getFollowRedirects() returns boolean public static
setRequestMethod
method setRequestMethod(method=String) public Signals ProtocolException
- Set the method for the URL request, one of:
- GET
- POST
- HEAD
- OPTIONS
- PUT
- DELETE
- TRACE
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.
getRequestMethod
method getRequestMethod() returns String public
- Get the request method.
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).
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).
disconnect
method disconnect() public abstract
- Close the connection to the server.
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