This subclass extends HttpURLConnection which in turns extends
URLConnection This is the actual class that "does the work",
such as connecting, sending request and getting the content from the remote
server.
connect() Establishes the connection to the remote HTTP server
Any methods that requires a valid connection to the resource will call
this method implicitly.
getErrorStream() Answers an 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.
setIfModifiedSince(long newValue) A slightly different implementation from this parent's
setIfModifiedSince() Since this HTTP impl supports
IfModifiedSince as one of the header field, the request header is updated
with the new value.
Creates an instance of the HttpURLConnection using default
port 80.
Parameters: url - URL The URL this connection is connecting
HttpURLConnection
protected HttpURLConnection(URL url, int port)(Code)
Creates an instance of the HttpURLConnection Parameters: url - URL The URL this connection is connecting Parameters: port - int The default connection port
HttpURLConnection
protected HttpURLConnection(URL url, int port, Proxy proxy)(Code)
Creates an instance of the HttpURLConnection Parameters: url - URL The URL this connection is connecting Parameters: port - int The default connection port Parameters: proxy - Proxy The proxy which is used to make the connection
Establishes the connection to the remote HTTP server
Any methods that requires a valid connection to the resource will call
this method implicitly. After the connection is established,
connected is set to true.
See Also:HttpURLConnection.connected See Also:java.io.IOException See Also:URLStreamHandler
Answers the value of the field at position pos.
Answers null if there is fewer than pos fields
in the response header.
java.lang.String The value of the field Parameters: pos - int the position of the field from the top See Also:HttpURLConnection.getHeaderField(String) See Also:HttpURLConnection.getHeaderFieldKey
Answers the value of the field corresponding to the key
Answers null if there is no such field.
If there are multiple fields with that key, the last field value is
returned.
java.lang.String The value of the header field Parameters: key - java.lang.String the name of the header field See Also:HttpURLConnection.getHeaderField(int) See Also:HttpURLConnection.getHeaderFieldKey
Provides an unmodifiable map of the connection header values. The map
keys are the String header field names. Each map value is a list of the
header field values associated with that key name.
the mapping of header field names to values since: 1.4
public static void setDefaultRequestProperty(String field, String value)(Code)
Sets the default request header fields to be sent to the remote server.
This does not affect the current URL Connection, only newly created ones.
Parameters: field - java.lang.String The name of the field to be changed Parameters: value - java.lang.String The new value of the field
setIfModifiedSince
public void setIfModifiedSince(long newValue)(Code)
A slightly different implementation from this parent's
setIfModifiedSince() Since this HTTP impl supports
IfModifiedSince as one of the header field, the request header is updated
with the new value.
Parameters: newValue - the number of millisecond since epoch throws: IllegalStateException - if already connected.