org.apache.mina.http

## Class HttpRequestImpl

- java.lang.Object
- - org.apache.mina.http.HttpRequestImpl

All Implemented Interfaces:
  HttpMessage, HttpPdu, HttpRequest

    public class HttpRequestImpl
    extends Object
    implements HttpRequest

Author:
  Apache MINA Project

### Constructor Summary

Constructors
Constructor and Description
`HttpRequestImpl(HttpVersion version, HttpMethod method, String requestedPath, Map<String,String> headers)`

### Method Summary

Methods
`boolean` `containsHeader(String name)` Returns `true` if the HTTP header with the specified name exists in this request.
`boolean` `containsParameter(String name)` Determines whether this request contains at least one parameter with the specified name
`ByteBuffer` `encode(HttpPduEncodingVisitor visitor)`
`String` `getContentType()` Gets the `Content-Type` header of the message.
`String` `getHeader(String name)` Returns the value of the HTTP header with the specified name.
`Map<String,String>` `getHeaders()` Returns a read-only `Map` of HTTP headers whose key is a `String` and whose value is a `String` s.
`HttpMethod` `getMethod()` Return the HTTP method used for this message `HttpMethod`
`String` `getParameter(String name)` Returns the value of a request parameter as a String, or null if the parameter does not exist.
`Map<String,List<String>>` `getParameters()` Returns a read only `Map` of query parameters whose key is a `String` and whose value is a `List` of `String`s.
`HttpVersion` `getProtocolVersion()` The HTTP version of the message
`boolean` `isKeepAlive()` Returns `true` if this message enables keep-alive connection.
`String` `toString()`

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

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

### Constructor Detail

#### HttpRequestImpl

    public HttpRequestImpl(HttpVersion version,
                   HttpMethod method,
                   String requestedPath,
                   Map<String,String> headers)

### Method Detail

#### getProtocolVersion

    public HttpVersion getProtocolVersion()

The HTTP version of the message

Specified by:
  `getProtocolVersion` in interface `HttpMessage`
Returns:
  HTTP/1.0 or HTTP/1.1

#### getContentType

    public String getContentType()

Gets the `Content-Type` header of the message.

Specified by:
  `getContentType` in interface `HttpMessage`
Returns:
  The content type.

#### isKeepAlive

    public boolean isKeepAlive()

Returns `true` if this message enables keep-alive connection.

Specified by:
  `isKeepAlive` in interface `HttpMessage`

#### getHeader

    public String getHeader(String name)

Returns the value of the HTTP header with the specified name. If more than one header with the given name is associated with this request, one is selected and returned.

Specified by:
  `getHeader` in interface `HttpMessage`
Parameters:
  `name` - The name of the desired header
Returns:
  The header value - or null if no header is found with the specified name

#### containsHeader

    public boolean containsHeader(String name)

Returns `true` if the HTTP header with the specified name exists in this request.

Specified by:
  `containsHeader` in interface `HttpMessage`

#### getHeaders

    public Map<String,String> getHeaders()

Returns a read-only `Map` of HTTP headers whose key is a `String` and whose value is a `String` s.

Specified by:
  `getHeaders` in interface `HttpMessage`

#### containsParameter

    public boolean containsParameter(String name)

Determines whether this request contains at least one parameter with the specified name

Specified by:
  `containsParameter` in interface `HttpRequest`
Parameters:
  `name` - The parameter name
Returns:
  `true` if this request contains at least one parameter with the specified name

#### getParameter

    public String getParameter(String name)

Returns the value of a request parameter as a String, or null if the parameter does not exist. If the request contained multiple parameters with the same name, this method returns the first parameter encountered in the request with the specified name

Specified by:
  `getParameter` in interface `HttpRequest`
Parameters:
  `name` - The parameter name
Returns:
  The value

#### getParameters

    public Map<String,List<String>> getParameters()

Returns a read only `Map` of query parameters whose key is a `String` and whose value is a `List` of `String`s.

Specified by:
  `getParameters` in interface `HttpRequest`

#### getMethod

    public HttpMethod getMethod()

Return the HTTP method used for this message `HttpMethod`

Specified by:
  `getMethod` in interface `HttpRequest`
Returns:
  the method

#### encode

    public ByteBuffer encode(HttpPduEncodingVisitor visitor)

Specified by:
  `encode` in interface `HttpPdu`

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`