Class HttpURLConnection
- java.lang.Object
-
- java.net.URLConnection
-
- java.net.HttpURLConnection
-
- org.apache.commons.httpclient.util.HttpURLConnection
-
@Deprecated public class HttpURLConnection extends HttpURLConnection
Deprecated.Jakarta Commons HttpClient 3.x is deprecated in the Jenkins project. It is not recommended to use it in any new code. Instead, use HTTP client API plugins as a dependency in your code. E.g. Apache HttpComponents Client API 4.x Plugin or Async HTTP Client Plugin.Provides aHttpURLConnection
wrapper around HttpClient'sHttpMethod
. This allows existing code to easily switch to HttpClieht without breaking existing interfaces using the JDKHttpURLConnection
. Note 1: The current implementations wraps only a connectedHttpMethod
, 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 forHttpURLConnection
(And I'm not even including the numerousHttpURLConnection
bugs!).- Since:
- 2.0
-
-
Field Summary
-
Fields inherited from class java.net.HttpURLConnection
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
-
-
Constructor Summary
Constructors Constructor Description HttpURLConnection(HttpMethod method, URL url)
Deprecated.Creates anHttpURLConnection
from aHttpMethod
.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
connect()
Deprecated.Not available: the data must have already been retrieved.void
disconnect()
Deprecated.Not yet implemented.boolean
getAllowUserInteraction()
Deprecated.Not yet implemented.Object
getContent()
Deprecated.Not yet implemented.Object
getContent(Class[] classes)
Deprecated.Not yet implemented.boolean
getDefaultUseCaches()
Deprecated.Not available: the data must have already been retrieved.boolean
getDoInput()
Deprecated.Not yet implemented.boolean
getDoOutput()
Deprecated.Not yet implemented.InputStream
getErrorStream()
Deprecated.Not yet implemented.String
getHeaderField(int position)
Deprecated.Return the header field at the specified positionString
getHeaderField(String name)
Deprecated.Return the header fieldString
getHeaderFieldKey(int keyPosition)
Deprecated.Return the header field keylong
getIfModifiedSince()
Deprecated.Not yet implemented.InputStream
getInputStream()
Deprecated.Gets an input stream for the HttpMethod response body.boolean
getInstanceFollowRedirects()
Deprecated.Not yet implemented.OutputStream
getOutputStream()
Deprecated.Permission
getPermission()
Deprecated.Not yet implemented.String
getRequestMethod()
Deprecated.Return the request method.String
getRequestProperty(String key)
Deprecated.Not yet implemented.int
getResponseCode()
Deprecated.Return the response code.String
getResponseMessage()
Deprecated.Return the response messageURL
getURL()
Deprecated.Return the URLboolean
getUseCaches()
Deprecated.Not yet implemented.void
setAllowUserInteraction(boolean isAllowInteraction)
Deprecated.Not available: the data must have already been retrieved.void
setDefaultUseCaches(boolean isUsingCaches)
Deprecated.Not available: the data must have already been retrieved.void
setDoInput(boolean isInput)
Deprecated.Not available: the data must have already been retrieved.void
setDoOutput(boolean isOutput)
Deprecated.Not available: the data must have already been retrieved.void
setIfModifiedSince(long modificationDate)
Deprecated.Not available: the data must have already been retrieved.void
setInstanceFollowRedirects(boolean isFollowingRedirects)
Deprecated.Not available: the data must have already been retrieved.void
setRequestMethod(String method)
Deprecated.Not available: the data must have already been retrieved.void
setRequestProperty(String key, String value)
Deprecated.Not available: the data must have already been retrieved.void
setUseCaches(boolean isUsingCaches)
Deprecated.Not available: the data must have already been retrieved.boolean
usingProxy()
Deprecated.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 Detail
-
HttpURLConnection
public HttpURLConnection(HttpMethod method, URL url)
Deprecated.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)
-
-
Method Detail
-
getInputStream
public InputStream getInputStream() throws IOException
Deprecated.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:
URLConnection.getInputStream()
,HttpMethod.getResponseBodyAsStream()
-
getErrorStream
public InputStream getErrorStream()
Deprecated.Not yet implemented. Return the error stream.- Overrides:
getErrorStream
in classHttpURLConnection
- See Also:
HttpURLConnection.getErrorStream()
-
disconnect
public void disconnect()
Deprecated.Not yet implemented.- Specified by:
disconnect
in classHttpURLConnection
- See Also:
HttpURLConnection.disconnect()
-
connect
public void connect() throws IOException
Deprecated.Not available: the data must have already been retrieved.- Specified by:
connect
in classURLConnection
- Throws:
IOException
- If an IO problem occurs.- See Also:
URLConnection.connect()
-
usingProxy
public boolean usingProxy()
Deprecated.Not yet implemented.- Specified by:
usingProxy
in classHttpURLConnection
- Returns:
- true if we are using a proxy.
- See Also:
HttpURLConnection.usingProxy()
-
getRequestMethod
public String getRequestMethod()
Deprecated.Return the request method.- Overrides:
getRequestMethod
in classHttpURLConnection
- Returns:
- The request method.
- See Also:
HttpURLConnection.getRequestMethod()
,HttpMethod.getName()
-
getResponseCode
public int getResponseCode() throws IOException
Deprecated.Return the response code.- Overrides:
getResponseCode
in classHttpURLConnection
- Returns:
- The response code.
- Throws:
IOException
- If an IO problem occurs.- See Also:
HttpURLConnection.getResponseCode()
,HttpMethod.getStatusCode()
-
getResponseMessage
public String getResponseMessage() throws IOException
Deprecated.Return the response message- Overrides:
getResponseMessage
in classHttpURLConnection
- Returns:
- The response message
- Throws:
IOException
- If an IO problem occurs.- See Also:
HttpURLConnection.getResponseMessage()
,HttpMethod.getStatusText()
-
getHeaderField
public String getHeaderField(String name)
Deprecated.Return the header field- Overrides:
getHeaderField
in classURLConnection
- Parameters:
name
- the name of the header- Returns:
- the header field.
- See Also:
URLConnection.getHeaderField(String)
,HttpMethod.getResponseHeaders()
-
getHeaderFieldKey
public String getHeaderFieldKey(int keyPosition)
Deprecated.Return the header field key- Overrides:
getHeaderFieldKey
in classHttpURLConnection
- Parameters:
keyPosition
- The key position- Returns:
- The header field key.
- See Also:
HttpURLConnection.getHeaderFieldKey(int)
,HttpMethod.getResponseHeaders()
-
getHeaderField
public String getHeaderField(int position)
Deprecated.Return the header field at the specified position- Overrides:
getHeaderField
in classHttpURLConnection
- Parameters:
position
- The position- Returns:
- The header field.
- See Also:
HttpURLConnection.getHeaderField(int)
,HttpMethod.getResponseHeaders()
-
getURL
public URL getURL()
Deprecated.Return the URL- Overrides:
getURL
in classURLConnection
- Returns:
- The URL.
- See Also:
URLConnection.getURL()
-
setInstanceFollowRedirects
public void setInstanceFollowRedirects(boolean isFollowingRedirects)
Deprecated.Not available: the data must have already been retrieved.- Overrides:
setInstanceFollowRedirects
in classHttpURLConnection
-
getInstanceFollowRedirects
public boolean getInstanceFollowRedirects()
Deprecated.Not yet implemented.- Overrides:
getInstanceFollowRedirects
in classHttpURLConnection
-
setRequestMethod
public void setRequestMethod(String method) throws ProtocolException
Deprecated.Not available: the data must have already been retrieved.- Overrides:
setRequestMethod
in classHttpURLConnection
- Throws:
ProtocolException
- See Also:
HttpURLConnection.setRequestMethod(String)
-
getPermission
public Permission getPermission() throws IOException
Deprecated.Not yet implemented.- Overrides:
getPermission
in classHttpURLConnection
- Throws:
IOException
- See Also:
HttpURLConnection.getPermission()
-
getContent
public Object getContent() throws IOException
Deprecated.Not yet implemented.- Overrides:
getContent
in classURLConnection
- Throws:
IOException
- See Also:
URLConnection.getContent()
-
getContent
public Object getContent(Class[] classes) throws IOException
Deprecated.Not yet implemented.- Overrides:
getContent
in classURLConnection
- Throws:
IOException
-
getOutputStream
public OutputStream getOutputStream() throws IOException
Deprecated.- Overrides:
getOutputStream
in classURLConnection
- Throws:
IOException
- See Also:
URLConnection.getOutputStream()
-
setDoInput
public void setDoInput(boolean isInput)
Deprecated.Not available: the data must have already been retrieved.- Overrides:
setDoInput
in classURLConnection
- See Also:
URLConnection.setDoInput(boolean)
-
getDoInput
public boolean getDoInput()
Deprecated.Not yet implemented.- Overrides:
getDoInput
in classURLConnection
- See Also:
URLConnection.getDoInput()
-
setDoOutput
public void setDoOutput(boolean isOutput)
Deprecated.Not available: the data must have already been retrieved.- Overrides:
setDoOutput
in classURLConnection
- See Also:
URLConnection.setDoOutput(boolean)
-
getDoOutput
public boolean getDoOutput()
Deprecated.Not yet implemented.- Overrides:
getDoOutput
in classURLConnection
- See Also:
URLConnection.getDoOutput()
-
setAllowUserInteraction
public void setAllowUserInteraction(boolean isAllowInteraction)
Deprecated.Not available: the data must have already been retrieved.- Overrides:
setAllowUserInteraction
in classURLConnection
- See Also:
URLConnection.setAllowUserInteraction(boolean)
-
getAllowUserInteraction
public boolean getAllowUserInteraction()
Deprecated.Not yet implemented.- Overrides:
getAllowUserInteraction
in classURLConnection
- See Also:
URLConnection.getAllowUserInteraction()
-
setUseCaches
public void setUseCaches(boolean isUsingCaches)
Deprecated.Not available: the data must have already been retrieved.- Overrides:
setUseCaches
in classURLConnection
- See Also:
URLConnection.setUseCaches(boolean)
-
getUseCaches
public boolean getUseCaches()
Deprecated.Not yet implemented.- Overrides:
getUseCaches
in classURLConnection
- See Also:
URLConnection.getUseCaches()
-
setIfModifiedSince
public void setIfModifiedSince(long modificationDate)
Deprecated.Not available: the data must have already been retrieved.- Overrides:
setIfModifiedSince
in classURLConnection
- See Also:
URLConnection.setIfModifiedSince(long)
-
getIfModifiedSince
public long getIfModifiedSince()
Deprecated.Not yet implemented.- Overrides:
getIfModifiedSince
in classURLConnection
- See Also:
URLConnection.getIfModifiedSince()
-
getDefaultUseCaches
public boolean getDefaultUseCaches()
Deprecated.Not available: the data must have already been retrieved.- Overrides:
getDefaultUseCaches
in classURLConnection
- See Also:
URLConnection.getDefaultUseCaches()
-
setDefaultUseCaches
public void setDefaultUseCaches(boolean isUsingCaches)
Deprecated.Not available: the data must have already been retrieved.- Overrides:
setDefaultUseCaches
in classURLConnection
- See Also:
URLConnection.setDefaultUseCaches(boolean)
-
setRequestProperty
public void setRequestProperty(String key, String value)
Deprecated.Not available: the data must have already been retrieved.- Overrides:
setRequestProperty
in classURLConnection
- See Also:
URLConnection.setRequestProperty(String,String)
-
getRequestProperty
public String getRequestProperty(String key)
Deprecated.Not yet implemented.- Overrides:
getRequestProperty
in classURLConnection
- See Also:
URLConnection.getRequestProperty(String)
-
-