Class HttpRequestWrapper
- java.lang.Object
- org.springframework.http.client.support.HttpRequestWrapper
- All Implemented Interfaces:
HttpMessage,HttpRequest
public class HttpRequestWrapper extends Object implements HttpRequest
Provides a convenient implementation of theHttpRequestinterface that can be overridden to adapt the request.These methods default to calling through to the wrapped request object.
- Since:
- 3.1
- Author:
- Arjen Poutsma
Constructor Summary
Constructors Constructor Description HttpRequestWrapper(HttpRequest request)Create a newHttpRequestwrapping the given request object.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HttpHeadersgetHeaders()Return the headers of the wrapped request.HttpMethodgetMethod()Return the method of the wrapped request.StringgetMethodValue()Return the method value of the wrapped request.HttpRequestgetRequest()Return the wrapped request.URIgetURI()Return the URI of the wrapped request.
Constructor Detail
HttpRequestWrapper
public HttpRequestWrapper(HttpRequest request)
Create a newHttpRequestwrapping the given request object.- Parameters:
request- the request object to be wrapped
Method Detail
getRequest
public HttpRequest getRequest()
Return the wrapped request.
getMethod
@Nullable public HttpMethod getMethod()
Return the method of the wrapped request.- Specified by:
getMethodin interfaceHttpRequest- Returns:
- the HTTP method as an HttpMethod enum value, or
nullif not resolvable (e.g. in case of a non-standard HTTP method) - See Also:
HttpRequest.getMethodValue(),HttpMethod.resolve(String)
getMethodValue
public String getMethodValue()
Return the method value of the wrapped request.- Specified by:
getMethodValuein interfaceHttpRequest- Returns:
- the HTTP method as a plain String
- See Also:
HttpRequest.getMethod()
getURI
public URI getURI()
Return the URI of the wrapped request.- Specified by:
getURIin interfaceHttpRequest- Returns:
- the URI of the request (never
null)
getHeaders
public HttpHeaders getHeaders()
Return the headers of the wrapped request.- Specified by:
getHeadersin interfaceHttpMessage- Returns:
- a corresponding HttpHeaders object (never
null)