| java.lang.Object java.net.URLConnection java.net.HttpURLConnection
Constructor Summary | |
protected | HttpURLConnection(URL url) Constructs a HttpURLConnection pointing to the resource
specified by the URL . |
Method Summary | |
abstract public void | disconnect() | public java.io.InputStream | getErrorStream() Answers a input stream from the server in the case of error such as the
requested file (txt, htm, html) is not found on the remote server. | public static boolean | getFollowRedirects() Answers the value of followRedirects which indicates if
this connection will follows a different URL redirected by the server. | public long | getHeaderFieldDate(String field, long defaultValue) Answers the date value in the form of milliseconds since epoch
corresponding to the field field . | public boolean | getInstanceFollowRedirects() Answers if this connection follows redirects. | public java.security.Permission | getPermission() Answers the permission object (in this case, SocketPermission) with the
host and the port number as the target name and "resolve, connect" as the
action list. | public String | getRequestMethod() Answers the request method which will be used to make the request to the
remote HTTP server. | public int | getResponseCode() | public String | getResponseMessage() Answers the response message returned the remote HTTP server
the response message. | public void | setChunkedStreamingMode(int chunklen) If length of a HTTP request body is NOT known ahead, enable chunked
transfer encoding to enable streaming without buffering. | public void | setFixedLengthStreamingMode(int contentLength) If length of a HTTP request body is known ahead, sets fixed length to
enable streaming without buffering. | public static void | setFollowRedirects(boolean auto) Sets the flag of whether this connection will follow redirects returned
by the remote server. | public void | setInstanceFollowRedirects(boolean followRedirects) Sets if this connection follows redirects. | public void | setRequestMethod(String method) Sets the request command which will be sent to the remote HTTP server. | abstract public boolean | usingProxy() Answers if this connection uses proxy. |
HTTP_ACCEPTED | final public static int HTTP_ACCEPTED(Code) | | Numeric status code, 202: Accepted
|
HTTP_BAD_GATEWAY | final public static int HTTP_BAD_GATEWAY(Code) | | Numeric status code, 502: Bad Gateway
|
HTTP_BAD_METHOD | final public static int HTTP_BAD_METHOD(Code) | | Numeric status code, 405: Bad Method
|
HTTP_BAD_REQUEST | final public static int HTTP_BAD_REQUEST(Code) | | Numeric status code, 400: Bad Request
|
HTTP_CLIENT_TIMEOUT | final public static int HTTP_CLIENT_TIMEOUT(Code) | | Numeric status code, 408: Client Timeout
|
HTTP_CONFLICT | final public static int HTTP_CONFLICT(Code) | | Numeric status code, 409: Conflict
|
HTTP_CREATED | final public static int HTTP_CREATED(Code) | | Numeric status code, 201: Created
|
HTTP_ENTITY_TOO_LARGE | final public static int HTTP_ENTITY_TOO_LARGE(Code) | | Numeric status code, 413: Entity too large
|
HTTP_FORBIDDEN | final public static int HTTP_FORBIDDEN(Code) | | Numeric status code, 403: Forbidden
|
HTTP_GATEWAY_TIMEOUT | final public static int HTTP_GATEWAY_TIMEOUT(Code) | | Numeric status code, 504: Gateway timeout
|
HTTP_GONE | final public static int HTTP_GONE(Code) | | Numeric status code, 410: Gone
|
HTTP_INTERNAL_ERROR | final public static int HTTP_INTERNAL_ERROR(Code) | | Numeric status code, 500: Internal error
|
HTTP_LENGTH_REQUIRED | final public static int HTTP_LENGTH_REQUIRED(Code) | | Numeric status code, 411: Length required
|
HTTP_MOVED_PERM | final public static int HTTP_MOVED_PERM(Code) | | Numeric status code, 301 Moved permanently
|
HTTP_MOVED_TEMP | final public static int HTTP_MOVED_TEMP(Code) | | Numeric status code, 302: Moved temporarily
|
HTTP_MULT_CHOICE | final public static int HTTP_MULT_CHOICE(Code) | | Numeric status code, 300: Multiple choices
|
HTTP_NOT_ACCEPTABLE | final public static int HTTP_NOT_ACCEPTABLE(Code) | | Numeric status code, 406: Not acceptable
|
HTTP_NOT_AUTHORITATIVE | final public static int HTTP_NOT_AUTHORITATIVE(Code) | | Numeric status code, 203: Not authoritative
|
HTTP_NOT_FOUND | final public static int HTTP_NOT_FOUND(Code) | | Numeric status code, 404: Not found
|
HTTP_NOT_IMPLEMENTED | final public static int HTTP_NOT_IMPLEMENTED(Code) | | Numeric status code, 501: Not implemented
|
HTTP_NOT_MODIFIED | final public static int HTTP_NOT_MODIFIED(Code) | | Numeric status code, 304: Not modified
|
HTTP_NO_CONTENT | final public static int HTTP_NO_CONTENT(Code) | | Numeric status code, 204: No content
|
HTTP_OK | final public static int HTTP_OK(Code) | | Numeric status code, 200: OK
|
HTTP_PARTIAL | final public static int HTTP_PARTIAL(Code) | | Numeric status code, 206: Partial
|
HTTP_PAYMENT_REQUIRED | final public static int HTTP_PAYMENT_REQUIRED(Code) | | Numeric status code, 402: Payment required
|
HTTP_PRECON_FAILED | final public static int HTTP_PRECON_FAILED(Code) | | Numeric status code, 412: Precondition failed
|
HTTP_PROXY_AUTH | final public static int HTTP_PROXY_AUTH(Code) | | Numeric status code, 407: Proxy authentication required
|
HTTP_REQ_TOO_LONG | final public static int HTTP_REQ_TOO_LONG(Code) | | Numeric status code, 414: Request too long
|
HTTP_RESET | final public static int HTTP_RESET(Code) | | Numeric status code, 205: Reset
|
HTTP_SEE_OTHER | final public static int HTTP_SEE_OTHER(Code) | | Numeric status code, 303: See other
|
HTTP_SERVER_ERROR | final public static int HTTP_SERVER_ERROR(Code) | | |
HTTP_UNAUTHORIZED | final public static int HTTP_UNAUTHORIZED(Code) | | Numeric status code, 401: Unauthorized
|
HTTP_UNAVAILABLE | final public static int HTTP_UNAVAILABLE(Code) | | Numeric status code, 503: Unavailable
|
HTTP_UNSUPPORTED_TYPE | final public static int HTTP_UNSUPPORTED_TYPE(Code) | | Numeric status code, 415: Unsupported type
|
HTTP_USE_PROXY | final public static int HTTP_USE_PROXY(Code) | | Numeric status code, 305: Use proxy
|
HTTP_VERSION | final public static int HTTP_VERSION(Code) | | Numeric status code, 505: Version not supported
|
chunkLength | protected int chunkLength(Code) | | |
fixedContentLength | protected int fixedContentLength(Code) | | |
instanceFollowRedirects | protected boolean instanceFollowRedirects(Code) | | |
responseCode | protected int responseCode(Code) | | |
HttpURLConnection | protected HttpURLConnection(URL url)(Code) | | Constructs a HttpURLConnection pointing to the resource
specified by the URL .
Parameters: url - the URL of this connection See Also: URL See Also: URLConnection |
getErrorStream | public java.io.InputStream getErrorStream()(Code) | | Answers a input stream from the server in the case of error such as the
requested file (txt, htm, html) is not found on the remote server.
If the content type is not what stated above,
FileNotFoundException is thrown.
the error input stream returned by the server. |
getFollowRedirects | public static boolean getFollowRedirects()(Code) | | Answers the value of followRedirects which indicates if
this connection will follows a different URL redirected by the server. It
is enabled by default.
The value of the flag See Also: HttpURLConnection.setFollowRedirects |
getHeaderFieldDate | public long getHeaderFieldDate(String field, long defaultValue)(Code) | | Answers the date value in the form of milliseconds since epoch
corresponding to the field field . Answers
defaultValue if no such field can be found in the response
header.
Parameters: field - the field in question Parameters: defaultValue - the default value if no field is found milliseconds since epoch |
getInstanceFollowRedirects | public boolean getInstanceFollowRedirects()(Code) | | Answers if this connection follows redirects.
true if this connection follows redirects, false otherwise. |
getPermission | public java.security.Permission getPermission() throws IOException(Code) | | Answers the permission object (in this case, SocketPermission) with the
host and the port number as the target name and "resolve, connect" as the
action list.
the permission object required for this connection throws: IOException - if an IO exception occurs during the creation of thepermission object. |
setChunkedStreamingMode | public void setChunkedStreamingMode(int chunklen)(Code) | | If length of a HTTP request body is NOT known ahead, enable chunked
transfer encoding to enable streaming without buffering. Notice that not
all http servers support this mode. Sets after connection will cause an
exception.
See Also: setFixedLengthStreamingMode Parameters: chunklen - the length of a chunk throws: IllegalStateException - if already connected or other mode already set |
setFixedLengthStreamingMode | public void setFixedLengthStreamingMode(int contentLength)(Code) | | If length of a HTTP request body is known ahead, sets fixed length to
enable streaming without buffering. Sets after connection will cause an
exception.
See Also: setChunkedStreamingMode Parameters: contentLength - the fixed length of the HTTP request body throws: IllegalStateException - if already connected or other mode already set throws: IllegalArgumentException - if contentLength is less than zero |
setFollowRedirects | public static void setFollowRedirects(boolean auto)(Code) | | Sets the flag of whether this connection will follow redirects returned
by the remote server. This method can only be called with the permission
from the security manager
Parameters: auto - The value to set See Also: java.lang.SecurityManager.checkSetFactory |
setInstanceFollowRedirects | public void setInstanceFollowRedirects(boolean followRedirects)(Code) | | Sets if this connection follows redirects.
Parameters: followRedirects - true if this connection should follows redirects, falseotherwise. |
usingProxy | abstract public boolean usingProxy()(Code) | | Answers if this connection uses proxy.
true if this connection supports proxy, false otherwise. |
|
|