## org.apache.http.impl.client
Class RequestWrapper

    java.lang.Object
      org.apache.http.message.AbstractHttpMessage
          org.apache.http.impl.client.RequestWrapper

All Implemented Interfaces:
  HttpUriRequest, HttpMessage, HttpRequest

Direct Known Subclasses:
  EntityEnclosingRequestWrapper

    @NotThreadSafe
    public class RequestWrapper

extends AbstractHttpMessage
implements HttpUriRequest

A wrapper class for `HttpRequest`s that can be used to change properties of the current request without modifying the original object.

This class is also capable of resetting the request headers to the state of the original request.

Since:
  4.0

Field Summary

Fields inherited from class org.apache.http.message.AbstractHttpMessage
`headergroup, params`

Constructor Summary
`RequestWrapper(HttpRequest request)`

Method Summary
`void` `abort()` Aborts execution of the request.
`int` `getExecCount()`
`String` `getMethod()` Returns the HTTP method this request uses, such as `GET`, `PUT`, `POST`, or other.
`HttpRequest` `getOriginal()`
`ProtocolVersion` `getProtocolVersion()`
`RequestLine` `getRequestLine()`
`URI` `getURI()` Returns the URI this request uses, such as `http://example.org/path/to/file`.
`void` `incrementExecCount()`
`boolean` `isAborted()` Tests if the request execution has been aborted.
`boolean` `isRepeatable()`
`void` `resetHeaders()`
`void` `setMethod(String method)`
`void` `setProtocolVersion(ProtocolVersion version)`
`void` `setURI(URI uri)`

Methods inherited from class org.apache.http.message.AbstractHttpMessage
`addHeader, addHeader, containsHeader, getAllHeaders, getFirstHeader, getHeaders, getLastHeader, getParams, headerIterator, headerIterator, removeHeader, removeHeaders, setHeader, setHeader, setHeaders, setParams`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.apache.http.HttpMessage
`addHeader, addHeader, containsHeader, getAllHeaders, getFirstHeader, getHeaders, getLastHeader, getParams, headerIterator, headerIterator, removeHeader, removeHeaders, setHeader, setHeader, setHeaders, setParams`

Constructor Detail

### RequestWrapper

    public RequestWrapper(HttpRequest request)
                   throws ProtocolException

Throws:
  `ProtocolException`

Method Detail

### resetHeaders

    public void resetHeaders()

### getMethod

    public String getMethod()

  Description copied from interface: `HttpUriRequest`
  Returns the HTTP method this request uses, such as `GET`, `PUT`, `POST`, or other.

  Specified by:
    `getMethod` in interface `HttpUriRequest`

### setMethod

    public void setMethod(String method)

### getProtocolVersion

    public ProtocolVersion getProtocolVersion()

  Specified by:
    `getProtocolVersion` in interface `HttpMessage`

### setProtocolVersion

    public void setProtocolVersion(ProtocolVersion version)

### getURI

    public URI getURI()

  Description copied from interface: `HttpUriRequest`
  Returns the URI this request uses, such as `http://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:
    `getURI` in interface `HttpUriRequest`

### setURI

    public void setURI(URI uri)

### getRequestLine

    public RequestLine getRequestLine()

  Specified by:
    `getRequestLine` in interface `HttpRequest`

### abort

    public void abort()
               throws UnsupportedOperationException

  Description copied from interface: `HttpUriRequest`
  Aborts execution of the request.

  Specified by:
    `abort` in interface `HttpUriRequest`
  Throws:
    `UnsupportedOperationException` - if the abort operation is not supported / cannot be implemented.

### isAborted

    public boolean isAborted()

  Description copied from interface: `HttpUriRequest`
  Tests if the request execution has been aborted.

  Specified by:
    `isAborted` in interface `HttpUriRequest`
  Returns:
    `true` if the request execution has been aborted, `false` otherwise.

### getOriginal

    public HttpRequest getOriginal()

### isRepeatable

    public boolean isRepeatable()

### getExecCount

    public int getExecCount()

### incrementExecCount

    public void incrementExecCount()

Copyright © 1999-2011 The Apache Software Foundation. All Rights Reserved.