Class WebProxy.HttpResponse

  • All Implemented Interfaces:
    Response
    Enclosing class:
    WebProxy

    public static class WebProxy.HttpResponse
    extends 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 Detail

      • getOutputStream

        public OutputStream getOutputStream()
        Getter for the data output stream.
        Specified by:
        getOutputStream in interface Response
        Returns:
        An open output stream.
        Throws:
        IOFailure - if an outputstream 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,
                              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​(String name,
                                   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 response.
        Specified by:
        getStatus in interface Response
        Returns:
        The HTTP status.