org.apache.mina.http.api

## Class DefaultHttpResponse

- java.lang.Object
- - org.apache.mina.http.api.DefaultHttpResponse

All Implemented Interfaces:
  HttpMessage, HttpPdu, HttpResponse

    public class DefaultHttpResponse
    extends Object
    implements HttpResponse

Author:
  Apache MINA Project

### Constructor Summary

Constructors
Constructor and Description
`DefaultHttpResponse(HttpVersion version, HttpStatus status, 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.
`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.
`HttpVersion` `getProtocolVersion()` The HTTP version of the message
`HttpStatus` `getStatus()` The HTTP status code for the HTTP response (e.g. 200 for OK, 404 for not found, etc..)
`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

#### DefaultHttpResponse

    public DefaultHttpResponse(HttpVersion version,
                       HttpStatus status,
                       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`

#### getStatus

    public HttpStatus getStatus()

The HTTP status code for the HTTP response (e.g. 200 for OK, 404 for not found, etc..)

Specified by:
  `getStatus` in interface `HttpResponse`
Returns:
  the status of the HTTP response

#### encode

    public ByteBuffer encode(HttpPduEncodingVisitor visitor)

Specified by:
  `encode` in interface `HttpPdu`

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`