net.craftforge.essential.context.basic
Class BasicResponseImpl

java.lang.Object
  extended by net.craftforge.essential.context.basic.BasicResponseImpl
All Implemented Interfaces:
Response

public class BasicResponseImpl
extends Object
implements Response

A basic implementation of a controller response.

Since:
20.06.11
Author:
Christian Bick

Constructor Summary
BasicResponseImpl(OutputStream outputStream)
          Creates a basic response.
 
Method Summary
 OutputStream getBodyOutputStream()
          Gets the output stream for streaming the response body.
 Map<String,String[]> getHeaders()
          Gets the HTTP headers of this response.
 HttpStatusCode getStatusCode()
          Gets the HTTP status code of this response.
 void sendHeaders(HttpStatusCode httpStatusCode, Map<String,String[]> headers)
          Sends the response headers and sets the HTTP response status.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicResponseImpl

public BasicResponseImpl(OutputStream outputStream)
Creates a basic response.

Parameters:
outputStream - The HTTP response body output stream.
Method Detail

sendHeaders

public void sendHeaders(HttpStatusCode httpStatusCode,
                        Map<String,String[]> headers)
Sends the response headers and sets the HTTP response status. Must be called prior to getBodyStream();

Specified by:
sendHeaders in interface Response
Parameters:
httpStatusCode - The response status
headers - The response headers

getStatusCode

public HttpStatusCode getStatusCode()
Gets the HTTP status code of this response.

Specified by:
getStatusCode in interface Response
Returns:
The HTTP status code

getHeaders

public Map<String,String[]> getHeaders()
Gets the HTTP headers of this response.

Specified by:
getHeaders in interface Response
Returns:
The HTTP headers

getBodyOutputStream

public OutputStream getBodyOutputStream()
Gets the output stream for streaming the response body.

Specified by:
getBodyOutputStream in interface Response
Returns:
The body output stream


Copyright © 2011. All Rights Reserved.