Package org.springframework.http.client.support

# 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 the `HttpRequest` interface 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 new `HttpRequest` wrapping the given request object.

## Method Summary

Modifier and Type
Method
Description
`Map<String,Object>`
`getAttributes()`
Return the attributes of the wrapped request.
`HttpHeaders`
`getHeaders()`
Return the headers of the wrapped request.
`HttpMethod`
`getMethod()`
Return the method of the wrapped request.
`HttpRequest`
`getRequest()`
Return the wrapped request.
`URI`
`getURI()`
Return the URI of the wrapped request.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### HttpRequestWrapper

public HttpRequestWrapper(HttpRequest request)
Create a new `HttpRequest` wrapping the given request object.

Parameters:
  `request` - the request object to be wrapped

## Method Details

### getRequest

public HttpRequest getRequest()
Return the wrapped request.

### getMethod

public HttpMethod getMethod()
Return the method of the wrapped request.

Specified by:
  `getMethod` in interface `HttpRequest`
Returns:
  the HTTP method as an HttpMethod value
See Also:
  - `HttpMethod.valueOf(String)`

### getURI

public URI getURI()
Return the URI of the wrapped request.

Specified by:
  `getURI` in interface `HttpRequest`
Returns:
  the URI of the request (never `null`)

### getAttributes

public Map<String,Object> getAttributes()
Return the attributes of the wrapped request.

Specified by:
  `getAttributes` in interface `HttpRequest`

### getHeaders

public HttpHeaders getHeaders()
Return the headers of the wrapped request.

Specified by:
  `getHeaders` in interface `HttpMessage`
Returns:
  a corresponding HttpHeaders object (never `null`)