java.lang.Object | ||
↳ | java.net.URLConnection | |
↳ | sun.net.www.URLConnection |
![]() |
A class to represent an active connection to an object represented by a URL.
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
properties |
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Create a URLConnection object.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
The following three methods addRequestProperty, getRequestProperty,
and getRequestProperties were copied from the superclass implementation
before it was changed by CR:6230836, to maintain backward compatibility.
| |||||||||||
Returns true if the data associated with this URL can be cached.
| |||||||||||
Call this to close the connection and flush any remaining data.
| |||||||||||
Call this routine to get the content-length associated with this
object.
| |||||||||||
Call this routine to get the content-type associated with this
object.
| |||||||||||
Returns the value of the named header field.
| |||||||||||
Return the value for the nth header field.
| |||||||||||
Return the key for the nth header field.
| |||||||||||
Call this routine to get the property list for this object.
| |||||||||||
Returns an unmodifiable Map of general request
properties for this connection.
| |||||||||||
Returns the value of the named general request property for this
connection.
| |||||||||||
Set the content type of this URL to a specific value.
| |||||||||||
Call this routine to set the property list for this object.
| |||||||||||
Sets the general request property.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Call this routine to set the content-length associated with this
object.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
Create a URLConnection object. These should not be created directly: instead they should be created by protocol handers in response to URL.openConnection.
u | The URL that this connects to. |
---|
The following three methods addRequestProperty, getRequestProperty, and getRequestProperties were copied from the superclass implementation before it was changed by CR:6230836, to maintain backward compatibility.
key | the keyword by which the request is known
(e.g., "accept "). |
---|---|
value | the value associated with it. |
Returns true if the data associated with this URL can be cached.
Call this to close the connection and flush any remaining data. Overriders must remember to call super.close()
Call this routine to get the content-length associated with this object.
-1
if the content length is
not known.
Call this routine to get the content-type associated with this object.
null
if not known.Returns the value of the named header field.
If called on a connection that sets the same header multiple times with possibly different values, only the last value is returned.
name | the name of a header field. |
---|
null
if there is no such field in the header.
Return the value for the nth header field. Returns null if there are fewer than n fields. This can be used in conjunction with getHeaderFieldKey to iterate through all the headers in the message.
n | an index, where n>=0 |
---|
n
th header field
or null
if there are fewer than n+1
fieldsReturn the key for the nth header field. Returns null if there are fewer than n fields. This can be used to iterate through all the headers in the message.
n | an index, where n>=0 |
---|
n
th header field,
or null
if there are fewer than n+1
fields.
Call this routine to get the property list for this object. Properties (like content-type) that have explicit getXX() methods associated with them should be accessed using those methods.
Returns an unmodifiable Map of general request properties for this connection. The Map keys are Strings that represent the request-header field names. Each Map value is a unmodifiable List of Strings that represents the corresponding field values.
Returns the value of the named general request property for this connection.
key | the keyword by which the request is known (e.g., "accept"). |
---|
Set the content type of this URL to a specific value.
type | The content type to use. One of the content_* static variables in this class should be used. eg. setType(URL.content_html); |
---|
Call this routine to set the property list for this object.
Sets the general request property. If a property with the key already exists, overwrite its value with the new value.
NOTE: HTTP requires all request properties which can legally have multiple instances with the same key to use a comma-seperated list syntax which enables multiple properties to be appended into a single property.
key | the keyword by which the request is known
(e.g., "accept "). |
---|---|
value | the value associated with it. |
Call this routine to set the content-length associated with this object.