Class HttpURLConnection
- java.lang.Object
-
- java.net.URLConnection
-
- java.net.HttpURLConnection
-
- org.apache.commons.httpclient.util.HttpURLConnection
-
@Deprecated public class HttpURLConnection extends java.net.HttpURLConnectionDeprecated.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 aHttpURLConnectionwrapper 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 numerousHttpURLConnectionbugs!).- 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, java.net.URL url)Deprecated.Creates anHttpURLConnectionfrom aHttpMethod.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidconnect()Deprecated.Not available: the data must have already been retrieved.voiddisconnect()Deprecated.Not yet implemented.booleangetAllowUserInteraction()Deprecated.Not yet implemented.java.lang.ObjectgetContent()Deprecated.Not yet implemented.java.lang.ObjectgetContent(java.lang.Class[] classes)Deprecated.Not yet implemented.booleangetDefaultUseCaches()Deprecated.Not available: the data must have already been retrieved.booleangetDoInput()Deprecated.Not yet implemented.booleangetDoOutput()Deprecated.Not yet implemented.java.io.InputStreamgetErrorStream()Deprecated.Not yet implemented.java.lang.StringgetHeaderField(int position)Deprecated.Return the header field at the specified positionjava.lang.StringgetHeaderField(java.lang.String name)Deprecated.Return the header fieldjava.lang.StringgetHeaderFieldKey(int keyPosition)Deprecated.Return the header field keylonggetIfModifiedSince()Deprecated.Not yet implemented.java.io.InputStreamgetInputStream()Deprecated.Gets an input stream for the HttpMethod response body.booleangetInstanceFollowRedirects()Deprecated.Not yet implemented.java.io.OutputStreamgetOutputStream()Deprecated.java.security.PermissiongetPermission()Deprecated.Not yet implemented.java.lang.StringgetRequestMethod()Deprecated.Return the request method.java.lang.StringgetRequestProperty(java.lang.String key)Deprecated.Not yet implemented.intgetResponseCode()Deprecated.Return the response code.java.lang.StringgetResponseMessage()Deprecated.Return the response messagejava.net.URLgetURL()Deprecated.Return the URLbooleangetUseCaches()Deprecated.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(java.lang.String method)Deprecated.Not available: the data must have already been retrieved.voidsetRequestProperty(java.lang.String key, java.lang.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.booleanusingProxy()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, java.net.URL url)
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 Detail
-
getInputStream
public java.io.InputStream getInputStream() throws java.io.IOExceptionDeprecated.Gets an input stream for the HttpMethod response body.- Overrides:
getInputStreamin classjava.net.URLConnection- Returns:
- The input stream.
- Throws:
java.io.IOException- If an IO problem occurs.- See Also:
URLConnection.getInputStream(),HttpMethod.getResponseBodyAsStream()
-
getErrorStream
public java.io.InputStream getErrorStream()
Deprecated.Not yet implemented. Return the error stream.- Overrides:
getErrorStreamin classjava.net.HttpURLConnection- See Also:
HttpURLConnection.getErrorStream()
-
disconnect
public void disconnect()
Deprecated.Not yet implemented.- Specified by:
disconnectin classjava.net.HttpURLConnection- See Also:
HttpURLConnection.disconnect()
-
connect
public void connect() throws java.io.IOExceptionDeprecated.Not available: the data must have already been retrieved.- Specified by:
connectin classjava.net.URLConnection- Throws:
java.io.IOException- If an IO problem occurs.- See Also:
URLConnection.connect()
-
usingProxy
public boolean usingProxy()
Deprecated.Not yet implemented.- Specified by:
usingProxyin classjava.net.HttpURLConnection- Returns:
- true if we are using a proxy.
- See Also:
HttpURLConnection.usingProxy()
-
getRequestMethod
public java.lang.String getRequestMethod()
Deprecated.Return the request method.- Overrides:
getRequestMethodin classjava.net.HttpURLConnection- Returns:
- The request method.
- See Also:
HttpURLConnection.getRequestMethod(),HttpMethod.getName()
-
getResponseCode
public int getResponseCode() throws java.io.IOExceptionDeprecated.Return the response code.- Overrides:
getResponseCodein classjava.net.HttpURLConnection- Returns:
- The response code.
- Throws:
java.io.IOException- If an IO problem occurs.- See Also:
HttpURLConnection.getResponseCode(),HttpMethod.getStatusCode()
-
getResponseMessage
public java.lang.String getResponseMessage() throws java.io.IOExceptionDeprecated.Return the response message- Overrides:
getResponseMessagein classjava.net.HttpURLConnection- Returns:
- The response message
- Throws:
java.io.IOException- If an IO problem occurs.- See Also:
HttpURLConnection.getResponseMessage(),HttpMethod.getStatusText()
-
getHeaderField
public java.lang.String getHeaderField(java.lang.String name)
Deprecated.Return the header field- Overrides:
getHeaderFieldin classjava.net.URLConnection- Parameters:
name- the name of the header- Returns:
- the header field.
- See Also:
URLConnection.getHeaderField(String),HttpMethod.getResponseHeaders()
-
getHeaderFieldKey
public java.lang.String getHeaderFieldKey(int keyPosition)
Deprecated.Return the header field key- Overrides:
getHeaderFieldKeyin classjava.net.HttpURLConnection- Parameters:
keyPosition- The key position- Returns:
- The header field key.
- See Also:
HttpURLConnection.getHeaderFieldKey(int),HttpMethod.getResponseHeaders()
-
getHeaderField
public java.lang.String getHeaderField(int position)
Deprecated.Return the header field at the specified position- Overrides:
getHeaderFieldin classjava.net.HttpURLConnection- Parameters:
position- The position- Returns:
- The header field.
- See Also:
HttpURLConnection.getHeaderField(int),HttpMethod.getResponseHeaders()
-
getURL
public java.net.URL getURL()
Deprecated.Return the URL- Overrides:
getURLin classjava.net.URLConnection- Returns:
- The URL.
- See Also:
URLConnection.getURL()
-
setInstanceFollowRedirects
public void setInstanceFollowRedirects(boolean isFollowingRedirects)
Deprecated.Not available: the data must have already been retrieved.- Overrides:
setInstanceFollowRedirectsin classjava.net.HttpURLConnection
-
getInstanceFollowRedirects
public boolean getInstanceFollowRedirects()
Deprecated.Not yet implemented.- Overrides:
getInstanceFollowRedirectsin classjava.net.HttpURLConnection
-
setRequestMethod
public void setRequestMethod(java.lang.String method) throws java.net.ProtocolExceptionDeprecated.Not available: the data must have already been retrieved.- Overrides:
setRequestMethodin classjava.net.HttpURLConnection- Throws:
java.net.ProtocolException- See Also:
HttpURLConnection.setRequestMethod(String)
-
getPermission
public java.security.Permission getPermission() throws java.io.IOExceptionDeprecated.Not yet implemented.- Overrides:
getPermissionin classjava.net.HttpURLConnection- Throws:
java.io.IOException- See Also:
HttpURLConnection.getPermission()
-
getContent
public java.lang.Object getContent() throws java.io.IOExceptionDeprecated.Not yet implemented.- Overrides:
getContentin classjava.net.URLConnection- Throws:
java.io.IOException- See Also:
URLConnection.getContent()
-
getContent
public java.lang.Object getContent(java.lang.Class[] classes) throws java.io.IOExceptionDeprecated.Not yet implemented.- Overrides:
getContentin classjava.net.URLConnection- Throws:
java.io.IOException
-
getOutputStream
public java.io.OutputStream getOutputStream() throws java.io.IOExceptionDeprecated.- Overrides:
getOutputStreamin classjava.net.URLConnection- Throws:
java.io.IOException- See Also:
URLConnection.getOutputStream()
-
setDoInput
public void setDoInput(boolean isInput)
Deprecated.Not available: the data must have already been retrieved.- Overrides:
setDoInputin classjava.net.URLConnection- See Also:
URLConnection.setDoInput(boolean)
-
getDoInput
public boolean getDoInput()
Deprecated.Not yet implemented.- Overrides:
getDoInputin classjava.net.URLConnection- See Also:
URLConnection.getDoInput()
-
setDoOutput
public void setDoOutput(boolean isOutput)
Deprecated.Not available: the data must have already been retrieved.- Overrides:
setDoOutputin classjava.net.URLConnection- See Also:
URLConnection.setDoOutput(boolean)
-
getDoOutput
public boolean getDoOutput()
Deprecated.Not yet implemented.- Overrides:
getDoOutputin classjava.net.URLConnection- See Also:
URLConnection.getDoOutput()
-
setAllowUserInteraction
public void setAllowUserInteraction(boolean isAllowInteraction)
Deprecated.Not available: the data must have already been retrieved.- Overrides:
setAllowUserInteractionin classjava.net.URLConnection- See Also:
URLConnection.setAllowUserInteraction(boolean)
-
getAllowUserInteraction
public boolean getAllowUserInteraction()
Deprecated.Not yet implemented.- Overrides:
getAllowUserInteractionin classjava.net.URLConnection- See Also:
URLConnection.getAllowUserInteraction()
-
setUseCaches
public void setUseCaches(boolean isUsingCaches)
Deprecated.Not available: the data must have already been retrieved.- Overrides:
setUseCachesin classjava.net.URLConnection- See Also:
URLConnection.setUseCaches(boolean)
-
getUseCaches
public boolean getUseCaches()
Deprecated.Not yet implemented.- Overrides:
getUseCachesin classjava.net.URLConnection- See Also:
URLConnection.getUseCaches()
-
setIfModifiedSince
public void setIfModifiedSince(long modificationDate)
Deprecated.Not available: the data must have already been retrieved.- Overrides:
setIfModifiedSincein classjava.net.URLConnection- See Also:
URLConnection.setIfModifiedSince(long)
-
getIfModifiedSince
public long getIfModifiedSince()
Deprecated.Not yet implemented.- Overrides:
getIfModifiedSincein classjava.net.URLConnection- See Also:
URLConnection.getIfModifiedSince()
-
getDefaultUseCaches
public boolean getDefaultUseCaches()
Deprecated.Not available: the data must have already been retrieved.- Overrides:
getDefaultUseCachesin classjava.net.URLConnection- See Also:
URLConnection.getDefaultUseCaches()
-
setDefaultUseCaches
public void setDefaultUseCaches(boolean isUsingCaches)
Deprecated.Not available: the data must have already been retrieved.- Overrides:
setDefaultUseCachesin classjava.net.URLConnection- See Also:
URLConnection.setDefaultUseCaches(boolean)
-
setRequestProperty
public void setRequestProperty(java.lang.String key, java.lang.String value)Deprecated.Not available: the data must have already been retrieved.- Overrides:
setRequestPropertyin classjava.net.URLConnection- See Also:
URLConnection.setRequestProperty(String,String)
-
getRequestProperty
public java.lang.String getRequestProperty(java.lang.String key)
Deprecated.Not yet implemented.- Overrides:
getRequestPropertyin classjava.net.URLConnection- See Also:
URLConnection.getRequestProperty(String)
-
-