Class HttpURLConnection
java.lang.Object
java.net.URLConnection
java.net.HttpURLConnection
edu.internet2.middleware.grouperClientExt.org.apache.commons.httpclient.util.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!).- Since:
- 2.0
- Version:
- $Id: HttpURLConnection.java 480424 2006-11-29 05:56:49Z bayard $
-
Field Summary
Fields inherited from class java.net.HttpURLConnection
chunkLength, fixedContentLength, fixedContentLengthLong, 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
ModifierConstructorDescriptionHttpURLConnection
(HttpMethod method, URL url) Creates anHttpURLConnection
from aHttpMethod
.protected
HttpURLConnection
(URL url) Create an instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
connect()
Not available: the data must have already been retrieved.void
Not yet implemented.boolean
Not yet implemented.Not yet implemented.getContent
(Class[] classes) Not yet implemented.boolean
Not available: the data must have already been retrieved.boolean
Not yet implemented.boolean
Not yet implemented.Not yet implemented.getHeaderField
(int position) Return the header field at the specified positiongetHeaderField
(String name) Return the header fieldgetHeaderFieldKey
(int keyPosition) Return the header field keylong
Not yet implemented.Gets an input stream for the HttpMethod response body.boolean
Not yet implemented.Not yet implemented.Return the request method.getRequestProperty
(String key) Not yet implemented.int
Return the response code.Return the response messagegetURL()
Return the URLboolean
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
Not yet implemented.Methods inherited from class java.net.HttpURLConnection
getFollowRedirects, getHeaderFieldDate, setAuthenticator, setChunkedStreamingMode, setFixedLengthStreamingMode, setFixedLengthStreamingMode, setFollowRedirects
Methods inherited from class java.net.URLConnection
addRequestProperty, getConnectTimeout, getContentEncoding, getContentLength, getContentLengthLong, getContentType, getDate, getDefaultAllowUserInteraction, getDefaultRequestProperty, getDefaultUseCaches, getExpiration, getFileNameMap, getHeaderFieldInt, getHeaderFieldLong, getHeaderFields, getLastModified, getReadTimeout, getRequestProperties, guessContentTypeFromName, guessContentTypeFromStream, setConnectTimeout, setContentHandlerFactory, setDefaultAllowUserInteraction, setDefaultRequestProperty, setDefaultUseCaches, setFileNameMap, setReadTimeout, toString
-
Constructor Details
-
HttpURLConnection
Creates anHttpURLConnection
from aHttpMethod
.- 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)
-
HttpURLConnection
Create an instance.- Parameters:
url
- The URL.- See Also:
-
-
Method Details
-
getInputStream
Gets an input stream for the HttpMethod response body.- Overrides:
getInputStream
in classURLConnection
- Returns:
- The input stream.
- Throws:
IOException
- If an IO problem occurs.- See Also:
-
getErrorStream
Not yet implemented. Return the error stream.- Overrides:
getErrorStream
in classHttpURLConnection
- See Also:
-
disconnect
public void disconnect()Not yet implemented.- Specified by:
disconnect
in classHttpURLConnection
- See Also:
-
connect
Not available: the data must have already been retrieved.- Specified by:
connect
in classURLConnection
- Throws:
IOException
- If an IO problem occurs.- See Also:
-
usingProxy
public boolean usingProxy()Not yet implemented.- Specified by:
usingProxy
in classHttpURLConnection
- Returns:
- true if we are using a proxy.
- See Also:
-
getRequestMethod
Return the request method.- Overrides:
getRequestMethod
in classHttpURLConnection
- Returns:
- The request method.
- See Also:
-
getResponseCode
Return the response code.- Overrides:
getResponseCode
in classHttpURLConnection
- Returns:
- The response code.
- Throws:
IOException
- If an IO problem occurs.- See Also:
-
getResponseMessage
Return the response message- Overrides:
getResponseMessage
in classHttpURLConnection
- Returns:
- The response message
- Throws:
IOException
- If an IO problem occurs.- See Also:
-
getHeaderField
Return the header field- Overrides:
getHeaderField
in classURLConnection
- Parameters:
name
- the name of the header- Returns:
- the header field.
- See Also:
-
getHeaderFieldKey
Return the header field key- Overrides:
getHeaderFieldKey
in classHttpURLConnection
- Parameters:
keyPosition
- The key position- Returns:
- The header field key.
- See Also:
-
getHeaderField
Return the header field at the specified position- Overrides:
getHeaderField
in classHttpURLConnection
- Parameters:
position
- The position- Returns:
- The header field.
- See Also:
-
getURL
Return the URL- Overrides:
getURL
in classURLConnection
- Returns:
- The URL.
- See Also:
-
setInstanceFollowRedirects
public void setInstanceFollowRedirects(boolean isFollowingRedirects) Not available: the data must have already been retrieved.- Overrides:
setInstanceFollowRedirects
in classHttpURLConnection
-
getInstanceFollowRedirects
public boolean getInstanceFollowRedirects()Not yet implemented.- Overrides:
getInstanceFollowRedirects
in classHttpURLConnection
-
setRequestMethod
Not available: the data must have already been retrieved.- Overrides:
setRequestMethod
in classHttpURLConnection
- Throws:
ProtocolException
- See Also:
-
getPermission
Not yet implemented.- Overrides:
getPermission
in classHttpURLConnection
- Throws:
IOException
- See Also:
-
getContent
Not yet implemented.- Overrides:
getContent
in classURLConnection
- Throws:
IOException
- See Also:
-
getContent
Not yet implemented.- Overrides:
getContent
in classURLConnection
- Throws:
IOException
-
getOutputStream
- Overrides:
getOutputStream
in classURLConnection
- Throws:
IOException
- See Also:
-
setDoInput
public void setDoInput(boolean isInput) Not available: the data must have already been retrieved.- Overrides:
setDoInput
in classURLConnection
- See Also:
-
getDoInput
public boolean getDoInput()Not yet implemented.- Overrides:
getDoInput
in classURLConnection
- See Also:
-
setDoOutput
public void setDoOutput(boolean isOutput) Not available: the data must have already been retrieved.- Overrides:
setDoOutput
in classURLConnection
- See Also:
-
getDoOutput
public boolean getDoOutput()Not yet implemented.- Overrides:
getDoOutput
in classURLConnection
- See Also:
-
setAllowUserInteraction
public void setAllowUserInteraction(boolean isAllowInteraction) Not available: the data must have already been retrieved.- Overrides:
setAllowUserInteraction
in classURLConnection
- See Also:
-
getAllowUserInteraction
public boolean getAllowUserInteraction()Not yet implemented.- Overrides:
getAllowUserInteraction
in classURLConnection
- See Also:
-
setUseCaches
public void setUseCaches(boolean isUsingCaches) Not available: the data must have already been retrieved.- Overrides:
setUseCaches
in classURLConnection
- See Also:
-
getUseCaches
public boolean getUseCaches()Not yet implemented.- Overrides:
getUseCaches
in classURLConnection
- See Also:
-
setIfModifiedSince
public void setIfModifiedSince(long modificationDate) Not available: the data must have already been retrieved.- Overrides:
setIfModifiedSince
in classURLConnection
- See Also:
-
getIfModifiedSince
public long getIfModifiedSince()Not yet implemented.- Overrides:
getIfModifiedSince
in classURLConnection
- See Also:
-
getDefaultUseCaches
public boolean getDefaultUseCaches()Not available: the data must have already been retrieved.- Overrides:
getDefaultUseCaches
in classURLConnection
- See Also:
-
setDefaultUseCaches
public void setDefaultUseCaches(boolean isUsingCaches) Not available: the data must have already been retrieved.- Overrides:
setDefaultUseCaches
in classURLConnection
- See Also:
-
setRequestProperty
Not available: the data must have already been retrieved.- Overrides:
setRequestProperty
in classURLConnection
- See Also:
-
getRequestProperty
Not yet implemented.- Overrides:
getRequestProperty
in classURLConnection
- See Also:
-