| |
|
| java.lang.Object java.net.URLConnection java.net.HttpURLConnection sun.net.www.protocol.http.HttpURLConnection
Method Summary | |
public void | addRequestProperty(String key, String value) Adds a general request property specified by a
key-value pair. | public void | connect() | public void | disconnect() | protected synchronized void | doTunneling() | public void | finalize() | public InputStream | getErrorStream() | public String | getHeaderField(String name) Gets a header field by name. | public String | getHeaderField(int n) Gets a header field by index. | public String | getHeaderFieldKey(int n) Gets a header field by index. | public Map | getHeaderFields() Returns an unmodifiable Map of the header fields.
The Map keys are Strings that represent the
response-header field names. | public synchronized InputStream | getInputStream() | String | getMethod() | public synchronized OutputStream | getOutputStream() | public Map | getRequestProperties() Returns an unmodifiable Map of general request
properties for this connection. | public String | getRequestProperty(String key) | public static InputStream | openConnectionCheckRedirects(URLConnection c) opens a stream allowing redirects only to the same host. | protected void | plainConnect() | protected void | proxiedConnect(URL url, String proxyHost, int proxyPort, boolean useCache) | void | setAuthenticationProperty(String key, String value) | public static void | setDefaultAuthenticator(HttpAuthenticator a) Use java.net.Authenticator.setDefault() instead. | protected void | setNewClient(URL url) Create a new HttpClient object, bypassing the cache of
HTTP client objects/connections. | protected void | setNewClient(URL url, boolean useCache) Obtain a HttpsClient object. | protected void | setProxiedClient(URL url, String proxyHost, int proxyPort) Create a new HttpClient object, set up so that it uses
per-instance proxying to the given HTTP proxy. | protected void | setProxiedClient(URL url, String proxyHost, int proxyPort, boolean useCache) Obtain a HttpClient object, set up so that it uses per-instance
proxying to the given HTTP proxy. | public void | setRequestProperty(String key, String value) Sets request property. | public boolean | usingProxy() |
defaultmaxRedirects | final static int defaultmaxRedirects(Code) | | |
maxRedirects | final static int maxRedirects(Code) | | |
needToCheck | boolean needToCheck(Code) | | |
validateProxy | final static boolean validateProxy(Code) | | |
validateServer | final static boolean validateServer(Code) | | |
HttpURLConnection | public HttpURLConnection(URL u, String host, int port) throws IOException(Code) | | this constructor is used by other protocol handlers such as ftp
that want to use http to fetch urls on their behalf.
|
addRequestProperty | public void addRequestProperty(String key, String value)(Code) | | Adds a general request property specified by a
key-value pair. This method will not overwrite
existing values associated with the same key.
Parameters: key - the keyword by which the request is known(e.g., "accept "). Parameters: value - the value associated with it. See Also: HttpURLConnection.getRequestProperties(java.lang.String) since: 1.4 |
disconnect | public void disconnect()(Code) | | Disconnect from the server (public API)
|
doTunneling | protected synchronized void doTunneling() throws IOException(Code) | | establish a tunnel through proxy server
|
finalize | public void finalize()(Code) | | |
getHeaderField | public String getHeaderField(String name)(Code) | | Gets a header field by name. Returns null if not known.
Parameters: name - the name of the header field |
getHeaderField | public String getHeaderField(int n)(Code) | | Gets a header field by index. Returns null if not known.
Parameters: n - the index of the header field |
getHeaderFieldKey | public String getHeaderFieldKey(int n)(Code) | | Gets a header field by index. Returns null if not known.
Parameters: n - the index of the header field |
getHeaderFields | public Map getHeaderFields()(Code) | | Returns an unmodifiable Map of the header fields.
The Map keys are Strings that represent the
response-header field names. Each Map value is an
unmodifiable List of Strings that represents
the corresponding field values.
a Map of header fields since: 1.4 |
getRequestProperties | public Map getRequestProperties()(Code) | | 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.
a Map of the general request properties for this connection. throws: IllegalStateException - if already connected since: 1.4 |
setDefaultAuthenticator | public static void setDefaultAuthenticator(HttpAuthenticator a)(Code) | | Use java.net.Authenticator.setDefault() instead.
|
setNewClient | protected void setNewClient(URL url) throws IOException(Code) | | Create a new HttpClient object, bypassing the cache of
HTTP client objects/connections.
Parameters: url - the URL being accessed |
setNewClient | protected void setNewClient(URL url, boolean useCache) throws IOException(Code) | | Obtain a HttpsClient object. Use the cached copy if specified.
Parameters: url - the URL being accessed Parameters: useCache - whether the cached connection should be usedif present |
setProxiedClient | protected void setProxiedClient(URL url, String proxyHost, int proxyPort) throws IOException(Code) | | Create a new HttpClient object, set up so that it uses
per-instance proxying to the given HTTP proxy. This
bypasses the cache of HTTP client objects/connections.
Parameters: url - the URL being accessed Parameters: proxyHost - the proxy host to use Parameters: proxyPort - the proxy port to use |
setProxiedClient | protected void setProxiedClient(URL url, String proxyHost, int proxyPort, boolean useCache) throws IOException(Code) | | Obtain a HttpClient object, set up so that it uses per-instance
proxying to the given HTTP proxy. Use the cached copy of HTTP
client objects/connections if specified.
Parameters: url - the URL being accessed Parameters: proxyHost - the proxy host to use Parameters: proxyPort - the proxy port to use Parameters: useCache - whether the cached connection should be usedif present |
setRequestProperty | public void setRequestProperty(String key, String value)(Code) | | Sets request property. If a property with the key already
exists, overwrite its value with the new value.
Parameters: value - the value to be set |
usingProxy | public boolean usingProxy()(Code) | | |
|
|
|