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,org.apache.http.HttpMessage,org.apache.http.HttpRequest
public class HttpRequestWrapper
extends org.apache.http.message.AbstractHttpMessage
implements HttpUriRequest
A wrapper class for
HttpRequest that can be used to change properties of the current
request without modifying the original object.- Since:
- 4.3
-
Field Summary
Fields inherited from class org.apache.http.message.AbstractHttpMessage
headergroup, params -
Method Summary
Modifier and TypeMethodDescriptionvoidabort()Aborts execution of the request.Returns the HTTP method this request uses, such asGET,PUT,POST, or other.org.apache.http.HttpRequestorg.apache.http.params.HttpParamsDeprecated.org.apache.http.ProtocolVersionorg.apache.http.RequestLineorg.apache.http.HttpHostgetURI()Returns the URI this request uses, such ashttp://example.org/path/to/file.booleanTests if the request execution has been aborted.voidsetProtocolVersion(org.apache.http.ProtocolVersion version) voidtoString()static HttpRequestWrapperwrap(org.apache.http.HttpRequest request) Creates a mutable wrapper of the original request.static HttpRequestWrapperwrap(org.apache.http.HttpRequest request, org.apache.http.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, setParamsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.http.HttpMessage
addHeader, addHeader, containsHeader, getAllHeaders, getFirstHeader, getHeaders, getLastHeader, headerIterator, headerIterator, removeHeader, removeHeaders, setHeader, setHeader, setHeaders, setParams
-
Method Details
-
getProtocolVersion
public org.apache.http.ProtocolVersion getProtocolVersion()- Specified by:
getProtocolVersionin interfaceorg.apache.http.HttpMessage
-
setProtocolVersion
public void setProtocolVersion(org.apache.http.ProtocolVersion version) -
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
-
getMethod
Description copied from interface:HttpUriRequestReturns the HTTP method this request uses, such asGET,PUT,POST, or other.- Specified by:
getMethodin interfaceHttpUriRequest
-
abort
Description copied from interface:HttpUriRequestAborts execution of the request.- Specified by:
abortin interfaceHttpUriRequest- Throws:
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 org.apache.http.RequestLine getRequestLine()- Specified by:
getRequestLinein interfaceorg.apache.http.HttpRequest
-
getOriginal
public org.apache.http.HttpRequest getOriginal() -
getTarget
public org.apache.http.HttpHost getTarget()- Since:
- 4.4
-
toString
-
wrap
Creates a mutable wrapper of the original request.- Parameters:
request- original request- Returns:
- mutable request wrappering the original one
-
wrap
public static HttpRequestWrapper wrap(org.apache.http.HttpRequest request, org.apache.http.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.(4.3) useRequestConfig.- Specified by:
getParamsin interfaceorg.apache.http.HttpMessage- Overrides:
getParamsin classorg.apache.http.message.AbstractHttpMessage
-
RequestConfig.