|
Java Platform 1.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.net.URLConnection | +--java.net.HttpURLConnection
A URLConnection with support for HTTP-specific features. See the spec for details.
Fields inherited from class java.net.URLConnection |
allowUserInteraction,
connected,
doInput,
doOutput,
ifModifiedSince,
url,
useCaches |
Constructor Summary | |
protected |
HttpURLConnection(URL u)
Constructor for the URLStreamHandler. |
Method Summary | |
abstract void |
disconnect()
Close the connection to the server. |
InputStream |
getErrorStream()
Returns the error stream if the connection failed but the server sent useful data nonetheless. |
static boolean |
getFollowRedirects()
|
Permission |
getPermission()
|
String |
getRequestMethod()
Get the request method. |
int |
getResponseCode()
Gets HTTP response status. |
String |
getResponseMessage()
Gets the HTTP response message, if any, returned along with the response code from a server. |
static void |
setFollowRedirects(boolean set)
Sets whether HTTP redirects (requests with response code 3xx) should be automatically followed by this class. |
void |
setRequestMethod(String method)
Set the method for the URL request, one of: GET POST HEAD OPTIONS PUT DELETE TRACE are legal, subject to protocol restrictions. |
abstract boolean |
usingProxy()
Indicates if the connection is going through a proxy. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
protected String method
protected int responseCode
protected String responseMessage
public static final int HTTP_OK
public static final int HTTP_CREATED
public static final int HTTP_ACCEPTED
public static final int HTTP_NOT_AUTHORITATIVE
public static final int HTTP_NO_CONTENT
public static final int HTTP_RESET
public static final int HTTP_PARTIAL
public static final int HTTP_MULT_CHOICE
public static final int HTTP_MOVED_PERM
public static final int HTTP_MOVED_TEMP
public static final int HTTP_SEE_OTHER
public static final int HTTP_NOT_MODIFIED
public static final int HTTP_USE_PROXY
public static final int HTTP_BAD_REQUEST
public static final int HTTP_UNAUTHORIZED
public static final int HTTP_PAYMENT_REQUIRED
public static final int HTTP_FORBIDDEN
public static final int HTTP_NOT_FOUND
public static final int HTTP_BAD_METHOD
public static final int HTTP_NOT_ACCEPTABLE
public static final int HTTP_PROXY_AUTH
public static final int HTTP_CLIENT_TIMEOUT
public static final int HTTP_CONFLICT
public static final int HTTP_GONE
public static final int HTTP_LENGTH_REQUIRED
public static final int HTTP_PRECON_FAILED
public static final int HTTP_ENTITY_TOO_LARGE
public static final int HTTP_REQ_TOO_LONG
public static final int HTTP_UNSUPPORTED_TYPE
public static final int HTTP_SERVER_ERROR
public static final int HTTP_INTERNAL_ERROR
public static final int HTTP_BAD_GATEWAY
public static final int HTTP_UNAVAILABLE
public static final int HTTP_GATEWAY_TIMEOUT
public static final int HTTP_VERSION
Constructor Detail |
protected HttpURLConnection(URL u)
Method Detail |
public static void setFollowRedirects(boolean set)
If there is a security manager, this method first calls
the security manager's checkSetFactory
method
to ensure the operation is allowed.
This could result in a SecurityException.
checkSetFactory
method doesn't allow the operation.SecurityManager.checkSetFactory()
public static boolean getFollowRedirects()
public void setRequestMethod(String method) throws ProtocolException
public String getRequestMethod()
public int getResponseCode() throws IOException
HTTP/1.0 200 OK HTTP/1.0 401 UnauthorizedExtracts the ints 200 and 401 respectively. Returns -1 if none can be discerned from the response (i.e., the response is not valid HTTP).
public String getResponseMessage() throws IOException
HTTP/1.0 200 OK HTTP/1.0 404 Not FoundExtracts the Strings "OK" and "Not Found" respectively. Returns null if none could be discerned from the responses (the result was not valid HTTP).
public abstract void disconnect()
public abstract boolean usingProxy()
public Permission getPermission() throws IOException
public InputStream getErrorStream()
This method will not cause a connection to be initiated. If there the connection was not connected, or if the server did not have an error while connecting or if the server did have an error but there no error data was sent, this method will return null. This is the default.
|
Java Platform 1.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |