## org.apache.http.message
Class BasicHttpRequest

    java.lang.Object
      org.apache.http.message.AbstractHttpMessage
          org.apache.http.message.BasicHttpRequest

All Implemented Interfaces:
  HttpMessage, HttpRequest

Direct Known Subclasses:
  BasicHttpEntityEnclosingRequest

    @NotThreadSafe
    public class BasicHttpRequest

extends AbstractHttpMessage
implements HttpRequest

Basic implementation of `HttpRequest`.

The following parameters can be used to customize the behavior of this class:

- `CoreProtocolPNames.PROTOCOL_VERSION`

Since:
  4.0

Field Summary

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

Constructor Summary
`BasicHttpRequest(RequestLine requestline)` Creates an instance of this class using the given request line.
`BasicHttpRequest(String method, String uri)` Creates an instance of this class using the given request method and URI.
`BasicHttpRequest(String method, String uri, ProtocolVersion ver)` Creates an instance of this class using the given request method, URI and the HTTP protocol version.

Method Summary
`ProtocolVersion` `getProtocolVersion()` Returns the HTTP protocol version to be used for this request.
`RequestLine` `getRequestLine()` Returns the request line of this request.
`String` `toString()`

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, 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

### BasicHttpRequest

    public BasicHttpRequest(String method,
                            String uri)

  Creates an instance of this class using the given request method and URI. The HTTP protocol version will be obtained from the `HttpParams` instance associated with the object. The initialization will be deferred until `getRequestLine()` is accessed for the first time.

  Parameters:
    `method` - request method.
    `uri` - request URI.

### BasicHttpRequest

    public BasicHttpRequest(String method,
                            String uri,
                            ProtocolVersion ver)

  Creates an instance of this class using the given request method, URI and the HTTP protocol version.

  Parameters:
    `method` - request method.
    `uri` - request URI.
    `ver` - HTTP protocol version.

### BasicHttpRequest

    public BasicHttpRequest(RequestLine requestline)

  Creates an instance of this class using the given request line.

  Parameters:
    `requestline` - request line.

Method Detail

### getProtocolVersion

    public ProtocolVersion getProtocolVersion()

  Returns the HTTP protocol version to be used for this request. If an HTTP protocol version was not explicitly set at the construction time, this method will obtain it from the `HttpParams` instance associated with the object.

  Specified by:
    `getProtocolVersion` in interface `HttpMessage`
  See Also:
    `BasicHttpRequest(String, String)`

### getRequestLine

    public RequestLine getRequestLine()

  Returns the request line of this request. If an HTTP protocol version was not explicitly set at the construction time, this method will obtain it from the `HttpParams` instance associated with the object.

  Specified by:
    `getRequestLine` in interface `HttpRequest`
  Returns:
    the request line.
  See Also:
    `BasicHttpRequest(String, String)`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

Copyright © 2005-2013 The Apache Software Foundation. All Rights Reserved.