|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.net.URLConnection
java.net.HttpURLConnection
com.microsoft.tfs.core.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.HttpURLConnection |
---|
chunkLength, fixedContentLength, HTTP_ACCEPTED, HTTP_BAD_GATEWAY, HTTP_BAD_METHOD, HTTP_BAD_REQUEST, HTTP_CLIENT_TIMEOUT, HTTP_CONFLICT, HTTP_CREATED, HTTP_ENTITY_TOO_LARGE, HTTP_FORBIDDEN, HTTP_GATEWAY_TIMEOUT, HTTP_GONE, HTTP_INTERNAL_ERROR, HTTP_LENGTH_REQUIRED, HTTP_MOVED_PERM, HTTP_MOVED_TEMP, HTTP_MULT_CHOICE, HTTP_NO_CONTENT, HTTP_NOT_ACCEPTABLE, HTTP_NOT_AUTHORITATIVE, HTTP_NOT_FOUND, HTTP_NOT_IMPLEMENTED, HTTP_NOT_MODIFIED, HTTP_OK, HTTP_PARTIAL, HTTP_PAYMENT_REQUIRED, HTTP_PRECON_FAILED, HTTP_PROXY_AUTH, HTTP_REQ_TOO_LONG, HTTP_RESET, HTTP_SEE_OTHER, HTTP_SERVER_ERROR, HTTP_UNAUTHORIZED, HTTP_UNAVAILABLE, HTTP_UNSUPPORTED_TYPE, HTTP_USE_PROXY, HTTP_VERSION, instanceFollowRedirects, responseCode, responseMessage |
Fields inherited from class java.net.URLConnection |
---|
allowUserInteraction, connected, doInput, doOutput, ifModifiedSince, useCaches |
Constructor Summary | |
---|---|
|
HttpURLConnection(HttpMethod method,
java.net.URL url)
Creates an HttpURLConnection from a HttpMethod . |
protected |
HttpURLConnection(java.net.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. |
java.lang.Object |
getContent()
Not yet implemented. |
java.lang.Object |
getContent(java.lang.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. |
java.io.InputStream |
getErrorStream()
Not yet implemented. |
java.lang.String |
getHeaderField(int position)
Return the header field at the specified position |
java.lang.String |
getHeaderField(java.lang.String name)
Return the header field |
java.lang.String |
getHeaderFieldKey(int keyPosition)
Return the header field key |
long |
getIfModifiedSince()
Not yet implemented. |
java.io.InputStream |
getInputStream()
Gets an input stream for the HttpMethod response body. |
boolean |
getInstanceFollowRedirects()
Not yet implemented. |
java.io.OutputStream |
getOutputStream()
|
java.security.Permission |
getPermission()
Not yet implemented. |
java.lang.String |
getRequestMethod()
Return the request method. |
java.lang.String |
getRequestProperty(java.lang.String key)
Not yet implemented. |
int |
getResponseCode()
Return the response code. |
java.lang.String |
getResponseMessage()
Return the response message |
java.net.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(java.lang.String method)
Not available: the data must have already been retrieved. |
void |
setRequestProperty(java.lang.String key,
java.lang.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.net.URLConnection |
---|
addRequestProperty, getConnectTimeout, getContentEncoding, getContentLength, getContentType, getDate, getDefaultAllowUserInteraction, getDefaultRequestProperty, getExpiration, getFileNameMap, getHeaderFieldInt, getHeaderFields, getLastModified, getReadTimeout, getRequestProperties, guessContentTypeFromName, guessContentTypeFromStream, setConnectTimeout, setContentHandlerFactory, setDefaultAllowUserInteraction, setDefaultRequestProperty, setFileNameMap, setReadTimeout, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public HttpURLConnection(HttpMethod method, java.net.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(java.net.URL url)
url
- The URL.HttpURLConnection.HttpURLConnection(URL)
Method Detail |
---|
public java.io.InputStream getInputStream() throws java.io.IOException
getInputStream
in class java.net.URLConnection
URLConnection.getInputStream()
,
HttpMethod.getResponseBodyAsStream()
java.io.IOException
- If an IO problem occurs.public java.io.InputStream getErrorStream()
getErrorStream
in class java.net.HttpURLConnection
HttpURLConnection.getErrorStream()
public void disconnect()
disconnect
in class java.net.HttpURLConnection
HttpURLConnection.disconnect()
public void connect() throws java.io.IOException
connect
in class java.net.URLConnection
URLConnection.connect()
java.io.IOException
- If an IO problem occurs.public boolean usingProxy()
usingProxy
in class java.net.HttpURLConnection
HttpURLConnection.usingProxy()
public java.lang.String getRequestMethod()
getRequestMethod
in class java.net.HttpURLConnection
HttpURLConnection.getRequestMethod()
,
HttpMethod.getName()
public int getResponseCode() throws java.io.IOException
getResponseCode
in class java.net.HttpURLConnection
HttpURLConnection.getResponseCode()
,
HttpMethod.getStatusCode()
java.io.IOException
- If an IO problem occurs.public java.lang.String getResponseMessage() throws java.io.IOException
getResponseMessage
in class java.net.HttpURLConnection
HttpURLConnection.getResponseMessage()
,
HttpMethod.getStatusText()
java.io.IOException
- If an IO problem occurs.public java.lang.String getHeaderField(java.lang.String name)
getHeaderField
in class java.net.URLConnection
name
- the name of the header
URLConnection.getHeaderField(String)
,
HttpMethod.getResponseHeaders()
public java.lang.String getHeaderFieldKey(int keyPosition)
getHeaderFieldKey
in class java.net.HttpURLConnection
keyPosition
- The key position
HttpURLConnection.getHeaderFieldKey(int)
,
HttpMethod.getResponseHeaders()
public java.lang.String getHeaderField(int position)
getHeaderField
in class java.net.HttpURLConnection
position
- The position
HttpURLConnection.getHeaderField(int)
,
HttpMethod.getResponseHeaders()
public java.net.URL getURL()
getURL
in class java.net.URLConnection
URLConnection.getURL()
public void setInstanceFollowRedirects(boolean isFollowingRedirects)
setInstanceFollowRedirects
in class java.net.HttpURLConnection
public boolean getInstanceFollowRedirects()
getInstanceFollowRedirects
in class java.net.HttpURLConnection
public void setRequestMethod(java.lang.String method) throws java.net.ProtocolException
setRequestMethod
in class java.net.HttpURLConnection
HttpURLConnection.setRequestMethod(String)
java.net.ProtocolException
public java.security.Permission getPermission() throws java.io.IOException
getPermission
in class java.net.HttpURLConnection
HttpURLConnection.getPermission()
java.io.IOException
public java.lang.Object getContent() throws java.io.IOException
getContent
in class java.net.URLConnection
URLConnection.getContent()
java.io.IOException
public java.lang.Object getContent(java.lang.Class[] classes) throws java.io.IOException
getContent
in class java.net.URLConnection
java.io.IOException
public java.io.OutputStream getOutputStream() throws java.io.IOException
getOutputStream
in class java.net.URLConnection
URLConnection.getOutputStream()
java.io.IOException
public void setDoInput(boolean isInput)
setDoInput
in class java.net.URLConnection
URLConnection.setDoInput(boolean)
public boolean getDoInput()
getDoInput
in class java.net.URLConnection
URLConnection.getDoInput()
public void setDoOutput(boolean isOutput)
setDoOutput
in class java.net.URLConnection
URLConnection.setDoOutput(boolean)
public boolean getDoOutput()
getDoOutput
in class java.net.URLConnection
URLConnection.getDoOutput()
public void setAllowUserInteraction(boolean isAllowInteraction)
setAllowUserInteraction
in class java.net.URLConnection
URLConnection.setAllowUserInteraction(boolean)
public boolean getAllowUserInteraction()
getAllowUserInteraction
in class java.net.URLConnection
URLConnection.getAllowUserInteraction()
public void setUseCaches(boolean isUsingCaches)
setUseCaches
in class java.net.URLConnection
URLConnection.setUseCaches(boolean)
public boolean getUseCaches()
getUseCaches
in class java.net.URLConnection
URLConnection.getUseCaches()
public void setIfModifiedSince(long modificationDate)
setIfModifiedSince
in class java.net.URLConnection
URLConnection.setIfModifiedSince(long)
public long getIfModifiedSince()
getIfModifiedSince
in class java.net.URLConnection
URLConnection.getIfModifiedSince()
public boolean getDefaultUseCaches()
getDefaultUseCaches
in class java.net.URLConnection
URLConnection.getDefaultUseCaches()
public void setDefaultUseCaches(boolean isUsingCaches)
setDefaultUseCaches
in class java.net.URLConnection
URLConnection.setDefaultUseCaches(boolean)
public void setRequestProperty(java.lang.String key, java.lang.String value)
setRequestProperty
in class java.net.URLConnection
URLConnection.setRequestProperty(String,String)
public java.lang.String getRequestProperty(java.lang.String key)
getRequestProperty
in class java.net.URLConnection
URLConnection.getRequestProperty(String)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |