Example usage for Java java.net HttpURLConnection fields, constructors, methods, implement or subclass
The text is from its open source code.
int | HTTP_OK HTTP Status-Code 200: OK. |
int | HTTP_CREATED HTTP Status-Code 201: Created. |
int | HTTP_ACCEPTED HTTP Status-Code 202: Accepted. |
int | HTTP_NOT_AUTHORITATIVE HTTP Status-Code 203: Non-Authoritative Information. |
int | HTTP_NO_CONTENT HTTP Status-Code 204: No Content. |
int | HTTP_RESET HTTP Status-Code 205: Reset Content. |
int | HTTP_PARTIAL HTTP Status-Code 206: Partial Content. |
int | HTTP_MULT_CHOICE HTTP Status-Code 300: Multiple Choices. |
int | HTTP_MOVED_PERM HTTP Status-Code 301: Moved Permanently. |
int | HTTP_MOVED_TEMP HTTP Status-Code 302: Temporary Redirect. |
int | HTTP_SEE_OTHER HTTP Status-Code 303: See Other. |
int | HTTP_NOT_MODIFIED HTTP Status-Code 304: Not Modified. |
int | HTTP_BAD_REQUEST HTTP Status-Code 400: Bad Request. |
int | HTTP_UNAUTHORIZED HTTP Status-Code 401: Unauthorized. |
int | HTTP_PAYMENT_REQUIRED HTTP Status-Code 402: Payment Required. |
int | HTTP_FORBIDDEN HTTP Status-Code 403: Forbidden. |
int | HTTP_NOT_FOUND HTTP Status-Code 404: Not Found. |
int | HTTP_BAD_METHOD HTTP Status-Code 405: Method Not Allowed. |
int | HTTP_NOT_ACCEPTABLE HTTP Status-Code 406: Not Acceptable. |
int | HTTP_PROXY_AUTH HTTP Status-Code 407: Proxy Authentication Required. |
int | HTTP_CLIENT_TIMEOUT HTTP Status-Code 408: Request Time-Out. |
int | HTTP_CONFLICT HTTP Status-Code 409: Conflict. |
int | HTTP_GONE HTTP Status-Code 410: Gone. |
int | HTTP_PRECON_FAILED HTTP Status-Code 412: Precondition Failed. |
int | HTTP_ENTITY_TOO_LARGE HTTP Status-Code 413: Request Entity Too Large. |
int | HTTP_REQ_TOO_LONG HTTP Status-Code 414: Request-URI Too Large. |
int | HTTP_UNSUPPORTED_TYPE HTTP Status-Code 415: Unsupported Media Type. |
int | HTTP_INTERNAL_ERROR HTTP Status-Code 500: Internal Server Error. |
int | HTTP_NOT_IMPLEMENTED HTTP Status-Code 501: Not Implemented. |
int | HTTP_BAD_GATEWAY HTTP Status-Code 502: Bad Gateway. |
int | HTTP_UNAVAILABLE HTTP Status-Code 503: Service Unavailable. |
int | HTTP_GATEWAY_TIMEOUT HTTP Status-Code 504: Gateway Timeout. |
int | HTTP_VERSION HTTP Status-Code 505: HTTP Version Not Supported. |
void | addRequestProperty(String key, String value) Adds a general request property specified by a key-value pair. |
void | connect() Opens a communications link to the resource referenced by this URL, if such a connection has not already been established. |
void | disconnect() Indicates that other requests to the server are unlikely in the near future. |
boolean | getAllowUserInteraction() Returns the value of the allowUserInteraction field for this object. |
Class> | getClass() Returns the runtime class of this Object . |
int | getConnectTimeout() Returns setting for connect timeout. |
Object | getContent() Retrieves the contents of this URL connection. |
String | getContentEncoding() Returns the value of the content-encoding header field. |
int | getContentLength() Returns the value of the content-length header field. |
long | getContentLengthLong() Returns the value of the content-length header field as a long. |
String | getContentType() Returns the value of the content-type header field. |
long | getDate() Returns the value of the date header field. |
boolean | getDoOutput() Returns the value of this URLConnection 's doOutput flag. |
InputStream | getErrorStream() Returns the error stream if the connection failed but the server sent useful data nonetheless. |
long | getExpiration() Returns the value of the expires header field. |
boolean | getFollowRedirects() Returns a boolean indicating whether or not HTTP redirects (3xx) should be automatically followed. |
String | getHeaderField(int n) Returns the value for the n th header field. |
long | getHeaderFieldDate(String name, long Default) |
int | getHeaderFieldInt(String name, int Default) Returns the value of the named field parsed as a number. |
String | getHeaderFieldKey(int n) Returns the key for the n th header field. |
long | getHeaderFieldLong(String name, long Default) Returns the value of the named field parsed as a number. |
Map | getHeaderFields() Returns an unmodifiable Map of the header fields. |
long | getIfModifiedSince() Returns the value of this object's ifModifiedSince field. |
InputStream | getInputStream() Returns an input stream that reads from this open connection. |
long | getLastModified() Returns the value of the last-modified header field. |
OutputStream | getOutputStream() Returns an output stream that writes to this connection. |
int | getReadTimeout() Returns setting for read timeout. |
String | getRequestMethod() Get the request method. |
Map | getRequestProperties() Returns an unmodifiable Map of general request properties for this connection. |
String | getRequestProperty(String key) Returns the value of the named general request property for this connection. |
int | getResponseCode() Gets the status code from an HTTP response message. |
String | getResponseMessage() Gets the HTTP response message, if any, returned along with the response code from a server. |
URL | getURL() Returns the value of this URLConnection 's URL field. |
void | setAllowUserInteraction(boolean allowuserinteraction) Set the value of the allowUserInteraction field of this URLConnection . |
void | setChunkedStreamingMode(int chunklen) This method is used to enable streaming of a HTTP request body without internal buffering, when the content length is not known in advance. |
void | setConnectTimeout(int timeout) Sets a specified timeout value, in milliseconds, to be used when opening a communications link to the resource referenced by this URLConnection. |
void | setDefaultUseCaches(boolean defaultusecaches) Sets the default value of the useCaches field to the specified value. |
void | setDoInput(boolean doinput) Sets the value of the doInput field for this URLConnection to the specified value. |
void | setDoOutput(boolean dooutput) Sets the value of the doOutput field for this URLConnection to the specified value. |
void | setFixedLengthStreamingMode(int contentLength) This method is used to enable streaming of a HTTP request body without internal buffering, when the content length is known in advance. |
void | setFixedLengthStreamingMode(long contentLength) This method is used to enable streaming of a HTTP request body without internal buffering, when the content length is known in advance. |
void | setFollowRedirects(boolean set) Sets whether HTTP redirects (requests with response code 3xx) should be automatically followed by this class. |
void | setIfModifiedSince(long ifmodifiedsince) Sets the value of the ifModifiedSince field of this URLConnection to the specified value. |
void | setInstanceFollowRedirects(boolean followRedirects) Sets whether HTTP redirects (requests with response code 3xx) should be automatically followed by this HttpURLConnection instance. |
void | setReadTimeout(int timeout) Sets the read timeout to a specified timeout, in milliseconds. |
void | setRequestMethod(String method) Set the method for the URL request, one of:
|
void | setRequestProperty(String key, String value) Sets the general request property. |
void | setUseCaches(boolean usecaches) Sets the value of the useCaches field of this URLConnection to the specified value. |
String | toString() Returns a String representation of this URL connection. |
boolean | usingProxy() Indicates if the connection is going through a proxy. |