com.flat502.rox.http
Class HttpResponse

java.lang.Object
  extended by com.flat502.rox.http.HttpMessage
      extended by com.flat502.rox.http.HttpResponse

public class HttpResponse
extends HttpMessage

This class represents an HTTP response and supports streaming that request out to an indicated stream.


Constructor Summary
HttpResponse(int statusCode, java.lang.String reasonPhrase)
          Constructs an instance
HttpResponse(int statusCode, java.lang.String reasonPhrase, Encoding encoding)
          Constructs an instance
HttpResponse(java.lang.String httpVersion, int statusCode, java.lang.String reasonPhrase)
          Constructs an instance
HttpResponse(java.lang.String httpVersion, int statusCode, java.lang.String reasonPhrase, Encoding encoding)
          Constructs an instance
 
Method Summary
protected  java.lang.String getVersionString()
          Get the HTTP version string for this instance.
protected  void marshalStartLine(java.io.OutputStream os)
          Constructs and returns the HTTP status line for this response.
 boolean mustCloseConnection()
           
 
Methods inherited from class com.flat502.rox.http.HttpMessage
addHeader, formatDate, getHeaderValue, getStartLine, isHeaderSet, marshal, marshal, marshalContent, marshalHeaders, normalizeHeaderName, setContent, setHeader, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HttpResponse

public HttpResponse(int statusCode,
                    java.lang.String reasonPhrase)
Constructs an instance


HttpResponse

public HttpResponse(java.lang.String httpVersion,
                    int statusCode,
                    java.lang.String reasonPhrase)
Constructs an instance


HttpResponse

public HttpResponse(int statusCode,
                    java.lang.String reasonPhrase,
                    Encoding encoding)
Constructs an instance


HttpResponse

public HttpResponse(java.lang.String httpVersion,
                    int statusCode,
                    java.lang.String reasonPhrase,
                    Encoding encoding)
Constructs an instance

Method Detail

getVersionString

protected java.lang.String getVersionString()
Description copied from class: HttpMessage
Get the HTTP version string for this instance.

Overrides:
getVersionString in class HttpMessage
Returns:
Always returns HTTP/1.1.

marshalStartLine

protected void marshalStartLine(java.io.OutputStream os)
                         throws java.io.IOException
Constructs and returns the HTTP status line for this response.

The request line is defined in section 6.1 of RFC 2616 and consists of the following three values delimited by spaces:

  1. The HTTP version returned by HttpMessage.getVersionString().
  2. The HTTP status code set in the constructor.
  3. The reason phrase set in the constructor.

Specified by:
marshalStartLine in class HttpMessage
Parameters:
os - The stream to write the start line to.
Throws:
java.io.IOException

mustCloseConnection

public boolean mustCloseConnection()