Package org.apache.http.client.methods
Class HttpRequestWrapper
- java.lang.Object
-
- org.apache.http.message.AbstractHttpMessage
-
- org.apache.http.client.methods.HttpRequestWrapper
-
- All Implemented Interfaces:
HttpUriRequest,HttpMessage,HttpRequest
public class HttpRequestWrapper extends AbstractHttpMessage implements HttpUriRequest
A wrapper class forHttpRequestthat can be used to change properties of the current request without modifying the original object.- Since:
- 4.3
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidabort()Aborts execution of the request.java.lang.StringgetMethod()Returns the HTTP method this request uses, such asGET,PUT,POST, or other.HttpRequestgetOriginal()HttpParamsgetParams()Deprecated.(4.3) useRequestConfig.ProtocolVersiongetProtocolVersion()Returns the protocol version this message is compatible with.RequestLinegetRequestLine()Returns the request line of this request.HttpHostgetTarget()java.net.URIgetURI()Returns the URI this request uses, such ashttp://example.org/path/to/file.booleanisAborted()Tests if the request execution has been aborted.voidsetProtocolVersion(ProtocolVersion version)voidsetURI(java.net.URI uri)java.lang.StringtoString()static HttpRequestWrapperwrap(HttpRequest request)Creates a mutable wrapper of the original request.static HttpRequestWrapperwrap(HttpRequest request, HttpHost target)Creates a mutable wrapper of the original request.-
Methods inherited from class org.apache.http.message.AbstractHttpMessage
addHeader, addHeader, containsHeader, getAllHeaders, getFirstHeader, getHeaders, getLastHeader, headerIterator, headerIterator, removeHeader, removeHeaders, setHeader, setHeader, setHeaders, setParams
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.http.HttpMessage
addHeader, addHeader, containsHeader, getAllHeaders, getFirstHeader, getHeaders, getLastHeader, headerIterator, headerIterator, removeHeader, removeHeaders, setHeader, setHeader, setHeaders, setParams
-
-
-
-
Method Detail
-
getProtocolVersion
public ProtocolVersion getProtocolVersion()
Description copied from interface:HttpMessageReturns the protocol version this message is compatible with.- Specified by:
getProtocolVersionin interfaceHttpMessage
-
setProtocolVersion
public void setProtocolVersion(ProtocolVersion version)
-
getURI
public java.net.URI getURI()
Description copied from interface:HttpUriRequestReturns the URI this request uses, such ashttp://example.org/path/to/file.Note that the URI may be absolute URI (as above) or may be a relative URI.
Implementations are encouraged to return the URI that was initially requested.
To find the final URI after any redirects have been processed, please see the section entitled HTTP execution context in the HttpClient Tutorial
- Specified by:
getURIin interfaceHttpUriRequest
-
setURI
public void setURI(java.net.URI uri)
-
getMethod
public java.lang.String getMethod()
Description copied from interface:HttpUriRequestReturns the HTTP method this request uses, such asGET,PUT,POST, or other.- Specified by:
getMethodin interfaceHttpUriRequest
-
abort
public void abort() throws java.lang.UnsupportedOperationExceptionDescription copied from interface:HttpUriRequestAborts execution of the request.- Specified by:
abortin interfaceHttpUriRequest- Throws:
java.lang.UnsupportedOperationException- if the abort operation is not supported / cannot be implemented.
-
isAborted
public boolean isAborted()
Description copied from interface:HttpUriRequestTests if the request execution has been aborted.- Specified by:
isAbortedin interfaceHttpUriRequest- Returns:
trueif the request execution has been aborted,falseotherwise.
-
getRequestLine
public RequestLine getRequestLine()
Description copied from interface:HttpRequestReturns the request line of this request.- Specified by:
getRequestLinein interfaceHttpRequest- Returns:
- the request line.
-
getOriginal
public HttpRequest getOriginal()
-
getTarget
public HttpHost getTarget()
- Since:
- 4.4
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
wrap
public static HttpRequestWrapper wrap(HttpRequest request)
Creates a mutable wrapper of the original request.- Parameters:
request- original request- Returns:
- mutable request wrappering the original one
-
wrap
public static HttpRequestWrapper wrap(HttpRequest request, HttpHost target)
Creates a mutable wrapper of the original request.- Parameters:
request- original requesttarget- original target, if explicitly specified- Returns:
- mutable request wrappering the original one
- Since:
- 4.4
-
getParams
@Deprecated public HttpParams getParams()
Deprecated.(4.3) useRequestConfig.Description copied from interface:HttpMessageReturns the parameters effective for this message as set byHttpMessage.setParams(HttpParams).- Specified by:
getParamsin interfaceHttpMessage- Overrides:
getParamsin classAbstractHttpMessage
-
-