HttpURLConnection
HttpURLConnection is a subclass of URLConnection that provides support for HTTP connections.
methods defined by HttpURLConnection:
static boolean getFollowRedirects( )
- Returns true if redirects are automatically followed and false otherwise.
String getRequestMethod( )
- Returns a string representing how URL requests are made. The default is GET. Other options, such as POST, are available.
int getResponseCode( ) throws IOException
- Returns the HTTP response code. -1 is returned if no response code can be obtained.
String getResponseMessage( ) throws IOException
- Returns the response message associated with the response code. Returns null if no message is available. An IOException is thrown if the connection fails.
static void setFollowRedirects(boolean how)
- If how is true, then redirects are automatically followed. If how is false, redirects are not automatically followed. By default, redirects are automatically followed.
void setRequestMethod(String how) throws ProtocolException
- Sets the method by which HTTP requests are made to that specified by how. The default method is GET, but other options, such as POST, are available.
Home
Java Book
Networking
Java Book
Networking
HttpURLConnection:
- HttpURLConnection
- HttpURLConnection.HTTP_OK
- HttpURLConnection: getContentLength()
- HttpURLConnection: getContentType()
- HttpURLConnection: getDate()
- HttpURLConnection: getExpiration()
- HttpURLConnection: getHeaderFields()
- HttpURLConnection: getInputStream()
- HttpURLConnection: getLastModified()
- HttpURLConnection: getRequestMethod
- HttpURLConnection: getResponseCode()
- HttpURLConnection: getResponseMessage()
- HttpURLConnection: setInstanceFollowRedirects(boolean followRedirects)
- HttpURLConnection: setRequestMethod(String method) throws ProtocolException
- HttpsURLConnection: getDefaultSSLSocketFactory()