|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.net.URLConnection java.net.HttpURLConnection org.apache.commons.httpclient.util.HttpURLConnection
public class HttpURLConnection
Provides a 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!).
Field Summary |
---|
Fields inherited from class java.net.URLConnection |
---|
allowUserInteraction, connected, doInput, doOutput, ifModifiedSince, useCaches |
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(int position)
Return the header field at the specified position |
String |
getHeaderField(String name)
Return the header field |
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. |
Methods inherited from class java.net.HttpURLConnection |
---|
getFollowRedirects, getHeaderFieldDate, setChunkedStreamingMode, setFixedLengthStreamingMode, setFollowRedirects |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public HttpURLConnection(HttpMethod method, URL url)
HttpURLConnection
from a HttpMethod
.
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)protected HttpURLConnection(URL url)
url
- The URL.HttpURLConnection.HttpURLConnection(URL)
Method Detail |
---|
public InputStream getInputStream() throws IOException
getInputStream
in class URLConnection
IOException
- If an IO problem occurs.URLConnection.getInputStream()
,
HttpMethod.getResponseBodyAsStream()
public InputStream getErrorStream()
getErrorStream
in class HttpURLConnection
HttpURLConnection.getErrorStream()
public void disconnect()
disconnect
in class HttpURLConnection
HttpURLConnection.disconnect()
public void connect() throws IOException
connect
in class URLConnection
IOException
- If an IO problem occurs.URLConnection.connect()
public boolean usingProxy()
usingProxy
in class HttpURLConnection
HttpURLConnection.usingProxy()
public String getRequestMethod()
getRequestMethod
in class HttpURLConnection
HttpURLConnection.getRequestMethod()
,
HttpMethod.getName()
public int getResponseCode() throws IOException
getResponseCode
in class HttpURLConnection
IOException
- If an IO problem occurs.HttpURLConnection.getResponseCode()
,
HttpMethod.getStatusCode()
public String getResponseMessage() throws IOException
getResponseMessage
in class HttpURLConnection
IOException
- If an IO problem occurs.HttpURLConnection.getResponseMessage()
,
HttpMethod.getStatusText()
public String getHeaderField(String name)
getHeaderField
in class URLConnection
name
- the name of the header
URLConnection.getHeaderField(String)
,
HttpMethod.getResponseHeaders()
public String getHeaderFieldKey(int keyPosition)
getHeaderFieldKey
in class HttpURLConnection
keyPosition
- The key position
HttpURLConnection.getHeaderFieldKey(int)
,
HttpMethod.getResponseHeaders()
public String getHeaderField(int position)
getHeaderField
in class HttpURLConnection
position
- The position
HttpURLConnection.getHeaderField(int)
,
HttpMethod.getResponseHeaders()
public URL getURL()
getURL
in class URLConnection
URLConnection.getURL()
public void setInstanceFollowRedirects(boolean isFollowingRedirects)
setInstanceFollowRedirects
in class HttpURLConnection
public boolean getInstanceFollowRedirects()
getInstanceFollowRedirects
in class HttpURLConnection
public void setRequestMethod(String method) throws ProtocolException
setRequestMethod
in class HttpURLConnection
ProtocolException
HttpURLConnection.setRequestMethod(String)
public Permission getPermission() throws IOException
getPermission
in class HttpURLConnection
IOException
HttpURLConnection.getPermission()
public Object getContent() throws IOException
getContent
in class URLConnection
IOException
URLConnection.getContent()
public Object getContent(Class[] classes) throws IOException
getContent
in class URLConnection
IOException
public OutputStream getOutputStream() throws IOException
getOutputStream
in class URLConnection
IOException
URLConnection.getOutputStream()
public void setDoInput(boolean isInput)
setDoInput
in class URLConnection
URLConnection.setDoInput(boolean)
public boolean getDoInput()
getDoInput
in class URLConnection
URLConnection.getDoInput()
public void setDoOutput(boolean isOutput)
setDoOutput
in class URLConnection
URLConnection.setDoOutput(boolean)
public boolean getDoOutput()
getDoOutput
in class URLConnection
URLConnection.getDoOutput()
public void setAllowUserInteraction(boolean isAllowInteraction)
setAllowUserInteraction
in class URLConnection
URLConnection.setAllowUserInteraction(boolean)
public boolean getAllowUserInteraction()
getAllowUserInteraction
in class URLConnection
URLConnection.getAllowUserInteraction()
public void setUseCaches(boolean isUsingCaches)
setUseCaches
in class URLConnection
URLConnection.setUseCaches(boolean)
public boolean getUseCaches()
getUseCaches
in class URLConnection
URLConnection.getUseCaches()
public void setIfModifiedSince(long modificationDate)
setIfModifiedSince
in class URLConnection
URLConnection.setIfModifiedSince(long)
public long getIfModifiedSince()
getIfModifiedSince
in class URLConnection
URLConnection.getIfModifiedSince()
public boolean getDefaultUseCaches()
getDefaultUseCaches
in class URLConnection
URLConnection.getDefaultUseCaches()
public void setDefaultUseCaches(boolean isUsingCaches)
setDefaultUseCaches
in class URLConnection
URLConnection.setDefaultUseCaches(boolean)
public void setRequestProperty(String key, String value)
setRequestProperty
in class URLConnection
URLConnection.setRequestProperty(String,String)
public String getRequestProperty(String key)
getRequestProperty
in class URLConnection
URLConnection.getRequestProperty(String)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |