HttpURLConnectionNameHttpURLConnectionSynopsis
DescriptionThe HttpURLConnection class is an abstract class that is a subclass of URLConnection. HttpURLConnection defines many of the HTTP server response codes as constants and provides methods for parsing server responses. An HttpURLConnection object defines a network connection to a resource specified by a URL. Essentially, the HttpURLConnection object represents the HTTP request for that resource. Class Summary
public abstract class java.net.HttpURLConnection extends java.net.URLConnection { // Constants public final static int HTTP_ACCEPTED; public final static int HTTP_BAD_GATEWAY; public final static int HTTP_BAD_METHOD; public final static int HTTP_BAD_REQUEST; public final static int HTTP_CLIENT_TIMEOUT; public final static int HTTP_CONFLICT; public final static int HTTP_CREATED; public final static int HTTP_ENTITY_TOO_LARGE; public final static int HTTP_FORBIDDEN; public final static int HTTP_GATEWAY_TIMEOUT; public final static int HTTP_GONE; public final static int HTTP_INTERNAL_ERROR; public final static int HTTP_LENGTH_REQUIRED; public final static int HTTP_MOVED_PERM; public final static int HTTP_MOVED_TEMP; public final static int HTTP_MULT_CHOICE; public final static int HTTP_NOT_ACCEPTABLE; public final static int HTTP_NOT_AUTHORITATIVE; public final static int HTTP_NOT_FOUND; public final static int HTTP_NOT_MODIFIED; public final static int HTTP_NO_CONTENT; public final static int HTTP_OK; public final static int HTTP_PARTIAL; public final static int HTTP_PAYMENT_REQUIRED; public final static int HTTP_PRECON_FAILED; public final static int HTTP_PROXY_AUTH; public final static int HTTP_REQ_TOO_LONG; public final static int HTTP_RESET; public final static int HTTP_SEE_OTHER; public final static int HTTP_SERVER_ERROR; public final static int HTTP_UNAUTHORIZED; public final static int HTTP_UNAVAILABLE; public final static int HTTP_UNSUPPORTED_TYPE; public final static int HTTP_USE_PROXY; public final static int HTTP_VERSION; // Variables protected String method; protected int responseCode; protected String responseMessage; // Constructors protected HttpURLConnection(URL u); // Class Methods public static boolean getFollowRedirects(); public static void setFollowRedirects(boolean set); // Instance Methods public abstract void disconnect(); public String getRequestMethod(); public int getResponseCode(); public String getResponseMessage(); public void setRequestMethod(String method); public abstract boolean usingProxy(); } ConstantsHTTP_ACCEPTEDpublic final static int HTTP_ACCEPTED = 202
HTTP_BAD_GATEWAYpublic final static int HTTP_BAD_GATEWAY = 502
HTTP_BAD_METHODpublic final static int HTTP_BAD_METHOD = 405
HTTP_BAD_REQUESTpublic final static int HTTP_BAD_REQUEST = 400
HTTP_CLIENT_TIMEOUTpublic final static int HTTP_CLIENT_TIMEOUT = 408
HTTP_CONFLICTpublic final static int HTTP_CONFLICT = 409
HTTP_CREATEDpublic final static int HTTP_CREATED = 201
HTTP_ENTITY_TOO_LARGEpublic final static int HTTP_ENTITY_TOO_LARGE = 413
HTTP_FORBIDDENpublic final static int HTTP_FORBIDDEN = 403
HTTP_GATEWAY_TIMEOUTpublic final static int HTTP_GATEWAY_TIMEOUT = 504
HTTP_GONEpublic final static int HTTP_GONE = 410
HTTP_INTERNAL_ERRORpublic final static int HTTP_INTERNAL_ERROR = 501
HTTP_LENGTH_REQUIREDpublic final static int HTTP_LENGTH_REQUIRED = 411
HTTP_MOVED_PERMpublic final static int HTTP_MOVED_PERM = 301
HTTP_MOVED_TEMPpublic final static int HTTP_MOVED_TEMP = 302
HTTP_MULT_CHOICEpublic final static int HTTP_MULT_CHOICE = 300
HTTP_NOT_ACCEPTABLEpublic final static int HTTP_NOT_ACCEPTABLE = 406
HTTP_NOT_AUTHORITATIVEpublic final static int HTTP_NOT_AUTHORITATIVE = 203
HTTP_NOT_FOUNDpublic final static int HTTP_NOT_FOUND = 404
HTTP_NOT_MODIFIEDpublic final static int HTTP_NOT_MODIFIED = 304
HTTP_NO_CONTENTpublic final static int HTTP_NO_CONTENT = 204
HTTP_OKpublic final static int HTTP_OK = 200
HTTP_PARTIALpublic final static int HTTP_PARTIAL = 206
HTTP_PAYMENT_REQUIREDpublic final static int HTTP_PAYMENT_REQUIRED = 402
HTTP_PRECON_FAILEDpublic final static int HTTP_PRECON_FAILED = 412
HTTP_PROXY_AUTHpublic final static int HTTP_PROXY_AUTH = 407
HTTP_REQ_TOO_LONGpublic final static int HTTP_REQ_TOO_LONG = 414
HTTP_RESETpublic final static int HTTP_RESET = 205
HTTP_SEE_OTHERpublic final static int HTTP_SEE_OTHER = 303
HTTP_SERVER_ERRORpublic final static int HTTP_SERVER_ERROR = 500
HTTP_UNAUTHORIZEDpublic final static int HTTP_UNAUTHORIZED = 401
HTTP_UNAVAILABLEpublic final static int HTTP_UNAVAILABLE = 503
HTTP_UNSUPPORTED_TYPEpublic final static int HTTP_UNSUPPORTED_TYPE = 415
HTTP_USE_PROXYpublic final static int HTTP_USE_PROXY = 305
HTTP_VERSIONpublic final static int HTTP_VERSION = 505
Variablesmethodprotected String method = "GET"
responseCodeprotected int responseCode = -1
responseMessageprotected String responseMessage = null
ConstructorsHttpURLConnectionprotected HttpURLConnection(URL u)
Class MethodsgetFollowRedirectspublic static boolean getFollowRedirects()
setFollowRedirectspublic static void setFollowRedirects(boolean set)
Instance Methodsdisconnectpublic abstract void disconnect()
getRequestMethodpublic String getRequestMethod()
getResponseCodepublic int getResponseCode() throws IOException
getResponseMessagepublic int getResponseMessage() throws IOException
setRequestMethod
public void setRequestMethod(String method) throws ProtocolException
usingProxypublic abstract boolean usingProxy()
Inherited Variables
Inherited Methods
See AlsoIOException, ProtocolException, SecurityException, SecurityManager, URL, URLConnection | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|