org.apache.commons.httpclient.util
public class HttpURLConnection extends HttpURLConnection
HttpURLConnection
wrapper around HttpClient's
HttpMethod
. This allows existing code to easily switch to
HttpClieht without breaking existing interfaces using the JDK
HttpURLConnection
.
Note 1: The current implementations wraps only a connected
HttpMethod
, ie a method that has alreayd been used to connect
to an HTTP server.
Note 2: It is a best try effort as different version of the JDK have
different behaviours for HttpURLConnection
(And I'm not even
including the numerous HttpURLConnection
bugs!).
Since: 2.0
Version: $Id: HttpURLConnection.java 155418 2005-02-26 13:01:52Z dirkv $
Constructor Summary | |
---|---|
HttpURLConnection(HttpMethod method, URL url)
Creates an HttpURLConnection from a HttpMethod .
| |
protected | HttpURLConnection(URL url)
Create an instance. |
Method Summary | |
---|---|
void | connect()
Not available: the data must have already been retrieved. |
void | disconnect()
Not yet implemented. |
boolean | getAllowUserInteraction()
Not yet implemented. |
Object | getContent()
Not yet implemented. |
Object | getContent(Class[] classes)
Not yet implemented. |
boolean | getDefaultUseCaches()
Not available: the data must have already been retrieved. |
boolean | getDoInput()
Not yet implemented. |
boolean | getDoOutput()
Not yet implemented. |
InputStream | getErrorStream()
Not yet implemented.
|
String | getHeaderField(String name)
Return the header field |
String | getHeaderField(int position)
Return the header field at the specified position |
String | getHeaderFieldKey(int keyPosition)
Return the header field key |
long | getIfModifiedSince()
Not yet implemented. |
InputStream | getInputStream()
Gets an input stream for the HttpMethod response body. |
boolean | getInstanceFollowRedirects()
Not yet implemented. |
OutputStream | getOutputStream() |
Permission | getPermission()
Not yet implemented. |
String | getRequestMethod()
Return the request method. |
String | getRequestProperty(String key)
Not yet implemented. |
int | getResponseCode()
Return the response code. |
String | getResponseMessage()
Return the response message |
URL | getURL()
Return the URL |
boolean | getUseCaches()
Not yet implemented. |
void | setAllowUserInteraction(boolean isAllowInteraction)
Not available: the data must have already been retrieved. |
void | setDefaultUseCaches(boolean isUsingCaches)
Not available: the data must have already been retrieved. |
void | setDoInput(boolean isInput)
Not available: the data must have already been retrieved. |
void | setDoOutput(boolean isOutput)
Not available: the data must have already been retrieved. |
void | setIfModifiedSince(long modificationDate)
Not available: the data must have already been retrieved. |
void | setInstanceFollowRedirects(boolean isFollowingRedirects)
Not available: the data must have already been retrieved. |
void | setRequestMethod(String method)
Not available: the data must have already been retrieved. |
void | setRequestProperty(String key, String value)
Not available: the data must have already been retrieved. |
void | setUseCaches(boolean isUsingCaches)
Not available: the data must have already been retrieved. |
boolean | usingProxy()
Not yet implemented. |
HttpURLConnection
from a HttpMethod
.
Parameters: method the theMethod that was used to connect to the HTTP server and which contains the returned data. url the URL to which we are connected (includes query string)
Parameters: url The URL.
See Also: java.net.HttpURLConnection#HttpURLConnection(URL)
Throws: IOException If an IO problem occurs.
See Also: java.net.HttpURLConnection#connect()
See Also: java.net.HttpURLConnection#disconnect()
See Also: java.net.HttpURLConnection#getAllowUserInteraction()
See Also: java.net.HttpURLConnection#getContent()
See Also: java.net.HttpURLConnection#getDefaultUseCaches()
See Also: java.net.HttpURLConnection#getDoInput()
See Also: java.net.HttpURLConnection#getDoOutput()
See Also: java.net.HttpURLConnection#getErrorStream()
Parameters: name the name of the header
Returns: the header field.
See Also: java.net.HttpURLConnection#getHeaderField(String) getResponseHeaders
Parameters: position The position
Returns: The header field.
See Also: java.net.HttpURLConnection#getHeaderField(int) getResponseHeaders
Parameters: keyPosition The key position
Returns: The header field key.
See Also: java.net.HttpURLConnection#getHeaderFieldKey(int) getResponseHeaders
See Also: java.net.HttpURLConnection#getIfModifiedSince()
Returns: The input stream.
Throws: IOException If an IO problem occurs.
See Also: java.net.HttpURLConnection#getInputStream() getResponseBodyAsStream
See Also: java.net.HttpURLConnection#getOutputStream()
See Also: java.net.HttpURLConnection#getPermission()
Returns: The request method.
See Also: java.net.HttpURLConnection#getRequestMethod() getName
See Also: java.net.HttpURLConnection#getRequestProperty(String)
Returns: The response code.
Throws: IOException If an IO problem occurs.
See Also: java.net.HttpURLConnection#getResponseCode() getStatusCode
Returns: The response message
Throws: IOException If an IO problem occurs.
See Also: java.net.HttpURLConnection#getResponseMessage() getStatusText
Returns: The URL.
See Also: java.net.HttpURLConnection#getURL()
See Also: java.net.HttpURLConnection#getUseCaches()
See Also: java.net.HttpURLConnection#setAllowUserInteraction(boolean)
See Also: java.net.HttpURLConnection#setDefaultUseCaches(boolean)
See Also: java.net.HttpURLConnection#setDoInput(boolean)
See Also: java.net.HttpURLConnection#setDoOutput(boolean)
See Also: java.net.HttpURLConnection#setIfModifiedSince(long)
See Also: java.net.HttpURLConnection#setRequestMethod(String)
See Also: java.net.HttpURLConnection#setRequestProperty(String,String)
See Also: java.net.HttpURLConnection#setUseCaches(boolean)
Returns: true if we are using a proxy.
See Also: java.net.HttpURLConnection#usingProxy()