Class HttpURLConnection
java.lang.Object
java.net.URLConnection
java.net.HttpURLConnection
org.apache.commons.httpclient.util.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 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
-
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
ConstructorsConstructorDescriptionHttpURLConnection(HttpMethod method, URL url) Deprecated.Creates anHttpURLConnectionfrom aHttpMethod. -
Method Summary
Modifier and TypeMethodDescriptionvoidconnect()Deprecated.Not available: the data must have already been retrieved.voidDeprecated.Not yet implemented.booleanDeprecated.Not yet implemented.Deprecated.Not yet implemented.getContent(Class[] classes) Deprecated.Not yet implemented.booleanDeprecated.Not available: the data must have already been retrieved.booleanDeprecated.Not yet implemented.booleanDeprecated.Not yet implemented.Deprecated.Not yet implemented.getHeaderField(int position) Deprecated.Return the header field at the specified positiongetHeaderField(String name) Deprecated.Return the header fieldgetHeaderFieldKey(int keyPosition) Deprecated.Return the header field keylongDeprecated.Not yet implemented.Deprecated.Gets an input stream for the HttpMethod response body.booleanDeprecated.Not yet implemented.Deprecated.Deprecated.Not yet implemented.Deprecated.Return the request method.getRequestProperty(String key) Deprecated.Not yet implemented.intDeprecated.Return the response code.Deprecated.Return the response messagegetURL()Deprecated.Return the URLbooleanDeprecated.Not yet implemented.voidsetAllowUserInteraction(boolean isAllowInteraction) Deprecated.Not available: the data must have already been retrieved.voidsetDefaultUseCaches(boolean isUsingCaches) Deprecated.Not available: the data must have already been retrieved.voidsetDoInput(boolean isInput) Deprecated.Not available: the data must have already been retrieved.voidsetDoOutput(boolean isOutput) Deprecated.Not available: the data must have already been retrieved.voidsetIfModifiedSince(long modificationDate) Deprecated.Not available: the data must have already been retrieved.voidsetInstanceFollowRedirects(boolean isFollowingRedirects) Deprecated.Not available: the data must have already been retrieved.voidsetRequestMethod(String method) Deprecated.Not available: the data must have already been retrieved.voidsetRequestProperty(String key, String value) Deprecated.Not available: the data must have already been retrieved.voidsetUseCaches(boolean isUsingCaches) Deprecated.Not available: the data must have already been retrieved.booleanDeprecated.Not yet implemented.Methods inherited from class java.net.HttpURLConnection
getFollowRedirects, getHeaderFieldDate, setAuthenticator, setChunkedStreamingMode, setFixedLengthStreamingMode, setFixedLengthStreamingMode, setFollowRedirectsMethods 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
Deprecated.Creates anHttpURLConnectionfrom 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 Details
-
getInputStream
Deprecated.Gets an input stream for the HttpMethod response body.- Overrides:
getInputStreamin classURLConnection- Returns:
- The input stream.
- Throws:
IOException- If an IO problem occurs.- See Also:
-
getErrorStream
Deprecated.Not yet implemented. Return the error stream.- Overrides:
getErrorStreamin classHttpURLConnection- See Also:
-
disconnect
public void disconnect()Deprecated.Not yet implemented.- Specified by:
disconnectin classHttpURLConnection- See Also:
-
connect
Deprecated.Not available: the data must have already been retrieved.- Specified by:
connectin classURLConnection- Throws:
IOException- If an IO problem occurs.- See Also:
-
usingProxy
public boolean usingProxy()Deprecated.Not yet implemented.- Specified by:
usingProxyin classHttpURLConnection- Returns:
- true if we are using a proxy.
- See Also:
-
getRequestMethod
Deprecated.Return the request method.- Overrides:
getRequestMethodin classHttpURLConnection- Returns:
- The request method.
- See Also:
-
getResponseCode
Deprecated.Return the response code.- Overrides:
getResponseCodein classHttpURLConnection- Returns:
- The response code.
- Throws:
IOException- If an IO problem occurs.- See Also:
-
getResponseMessage
Deprecated.Return the response message- Overrides:
getResponseMessagein classHttpURLConnection- Returns:
- The response message
- Throws:
IOException- If an IO problem occurs.- See Also:
-
getHeaderField
Deprecated.Return the header field- Overrides:
getHeaderFieldin classURLConnection- Parameters:
name- the name of the header- Returns:
- the header field.
- See Also:
-
getHeaderFieldKey
Deprecated.Return the header field key- Overrides:
getHeaderFieldKeyin classHttpURLConnection- Parameters:
keyPosition- The key position- Returns:
- The header field key.
- See Also:
-
getHeaderField
Deprecated.Return the header field at the specified position- Overrides:
getHeaderFieldin classHttpURLConnection- Parameters:
position- The position- Returns:
- The header field.
- See Also:
-
getURL
Deprecated.Return the URL- Overrides:
getURLin classURLConnection- Returns:
- The URL.
- See Also:
-
setInstanceFollowRedirects
public void setInstanceFollowRedirects(boolean isFollowingRedirects) Deprecated.Not available: the data must have already been retrieved.- Overrides:
setInstanceFollowRedirectsin classHttpURLConnection
-
getInstanceFollowRedirects
public boolean getInstanceFollowRedirects()Deprecated.Not yet implemented.- Overrides:
getInstanceFollowRedirectsin classHttpURLConnection
-
setRequestMethod
Deprecated.Not available: the data must have already been retrieved.- Overrides:
setRequestMethodin classHttpURLConnection- Throws:
ProtocolException- See Also:
-
getPermission
Deprecated.Not yet implemented.- Overrides:
getPermissionin classHttpURLConnection- Throws:
IOException- See Also:
-
getContent
Deprecated.Not yet implemented.- Overrides:
getContentin classURLConnection- Throws:
IOException- See Also:
-
getContent
Deprecated.Not yet implemented.- Overrides:
getContentin classURLConnection- Throws:
IOException
-
getOutputStream
Deprecated.- Overrides:
getOutputStreamin classURLConnection- Throws:
IOException- See Also:
-
setDoInput
public void setDoInput(boolean isInput) Deprecated.Not available: the data must have already been retrieved.- Overrides:
setDoInputin classURLConnection- See Also:
-
getDoInput
public boolean getDoInput()Deprecated.Not yet implemented.- Overrides:
getDoInputin classURLConnection- See Also:
-
setDoOutput
public void setDoOutput(boolean isOutput) Deprecated.Not available: the data must have already been retrieved.- Overrides:
setDoOutputin classURLConnection- See Also:
-
getDoOutput
public boolean getDoOutput()Deprecated.Not yet implemented.- Overrides:
getDoOutputin classURLConnection- See Also:
-
setAllowUserInteraction
public void setAllowUserInteraction(boolean isAllowInteraction) Deprecated.Not available: the data must have already been retrieved.- Overrides:
setAllowUserInteractionin classURLConnection- See Also:
-
getAllowUserInteraction
public boolean getAllowUserInteraction()Deprecated.Not yet implemented.- Overrides:
getAllowUserInteractionin classURLConnection- See Also:
-
setUseCaches
public void setUseCaches(boolean isUsingCaches) Deprecated.Not available: the data must have already been retrieved.- Overrides:
setUseCachesin classURLConnection- See Also:
-
getUseCaches
public boolean getUseCaches()Deprecated.Not yet implemented.- Overrides:
getUseCachesin classURLConnection- See Also:
-
setIfModifiedSince
public void setIfModifiedSince(long modificationDate) Deprecated.Not available: the data must have already been retrieved.- Overrides:
setIfModifiedSincein classURLConnection- See Also:
-
getIfModifiedSince
public long getIfModifiedSince()Deprecated.Not yet implemented.- Overrides:
getIfModifiedSincein classURLConnection- See Also:
-
getDefaultUseCaches
public boolean getDefaultUseCaches()Deprecated.Not available: the data must have already been retrieved.- Overrides:
getDefaultUseCachesin classURLConnection- See Also:
-
setDefaultUseCaches
public void setDefaultUseCaches(boolean isUsingCaches) Deprecated.Not available: the data must have already been retrieved.- Overrides:
setDefaultUseCachesin classURLConnection- See Also:
-
setRequestProperty
Deprecated.Not available: the data must have already been retrieved.- Overrides:
setRequestPropertyin classURLConnection- See Also:
-
getRequestProperty
Deprecated.Not yet implemented.- Overrides:
getRequestPropertyin classURLConnection- See Also:
-