dk.netarkivet.viewerproxy
Class WebProxy.HttpResponse

java.lang.Object
  extended by dk.netarkivet.viewerproxy.WebProxy.HttpResponse
All Implemented Interfaces:
Response
Enclosing class:
WebProxy

public static class WebProxy.HttpResponse
extends java.lang.Object
implements Response

A wrapper around the Jetty HttpResponse, giving the simple Response interface used in our URIResolvers. Also Collects and remembers status code for a response.


Method Summary
 void addHeaderField(java.lang.String name, java.lang.String value)
          Add an HTTP header to the response.
 java.io.OutputStream getOutputStream()
          Getter for the data output stream.
 int getStatus()
          Get the HTTP status of this repsonse.
 void setStatus(int statusCode)
          Setter for the status code (e.g.
 void setStatus(int statusCode, java.lang.String reason)
          Set status code and explanatory text string describing the status.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getOutputStream

public java.io.OutputStream getOutputStream()
Getter for the data output stream.

Specified by:
getOutputStream in interface Response
Returns:
An open output stream.
Throws:
IOFailure - if an outprutstream can not be obtained (on invalidated response).

setStatus

public void setStatus(int statusCode)
Setter for the status code (e.g. 200, 404)

Specified by:
setStatus in interface Response
Parameters:
statusCode - An HTTP status code.

setStatus

public void setStatus(int statusCode,
                      java.lang.String reason)
Set status code and explanatory text string describing the status.

Specified by:
setStatus in interface Response
Parameters:
statusCode - should be valid http status ie. 200, 404,
reason - text string explaining status ie. OK, not found,

addHeaderField

public void addHeaderField(java.lang.String name,
                           java.lang.String value)
Add an HTTP header to the response.

Specified by:
addHeaderField in interface Response
Parameters:
name - Name of the header, e.g. Last-Modified-Date
value - The value of the header

getStatus

public int getStatus()
Get the HTTP status of this repsonse.

Specified by:
getStatus in interface Response
Returns:
The HTTP status.