Class MockHttpResponse

  • All Implemented Interfaces:
    HttpResponse

    public class MockHttpResponse
    extends java.lang.Object
    implements HttpResponse
    Acts as a bridge between asynchronous message and reply
    Version:
    $Revision: 1 $
    • Field Detail

      • status

        protected int status
      • baos

        protected java.io.ByteArrayOutputStream baos
      • os

        protected java.io.OutputStream os
      • newCookies

        protected java.util.List<javax.ws.rs.core.NewCookie> newCookies
      • errorMessage

        protected java.lang.String errorMessage
      • sentError

        protected boolean sentError
    • Constructor Detail

      • MockHttpResponse

        public MockHttpResponse()
    • Method Detail

      • getOutputHeaders

        public javax.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.Object> getOutputHeaders()
        Specified by:
        getOutputHeaders in interface HttpResponse
      • getOutputStream

        public java.io.OutputStream getOutputStream()
                                             throws java.io.IOException
        Specified by:
        getOutputStream in interface HttpResponse
        Throws:
        java.io.IOException
      • getOutput

        public byte[] getOutput()
      • getContentAsString

        public java.lang.String getContentAsString()
      • addNewCookie

        public void addNewCookie​(javax.ws.rs.core.NewCookie cookie)
        Specified by:
        addNewCookie in interface HttpResponse
      • sendError

        public void sendError​(int status)
                       throws java.io.IOException
        Specified by:
        sendError in interface HttpResponse
        Throws:
        java.io.IOException
      • sendError

        public void sendError​(int status,
                              java.lang.String message)
                       throws java.io.IOException
        Specified by:
        sendError in interface HttpResponse
        Throws:
        java.io.IOException
      • getNewCookies

        public java.util.List<javax.ws.rs.core.NewCookie> getNewCookies()
      • getErrorMessage

        public java.lang.String getErrorMessage()
      • isErrorSent

        public boolean isErrorSent()
      • reset

        public void reset()
        Description copied from interface: HttpResponse
        reset status and headers. Will fail if response is committed
        Specified by:
        reset in interface HttpResponse