org.jboss.resteasy.mock
Class MockHttpResponse

java.lang.Object
  extended by org.jboss.resteasy.mock.MockHttpResponse
All Implemented Interfaces:
HttpResponse

public class MockHttpResponse
extends Object
implements HttpResponse

Acts as a bridge between asynchronous message and reply

Version:
$Revision: 1 $
Author:
Bill Burke

Field Summary
protected  ByteArrayOutputStream baos
           
protected  String errorMessage
           
protected  List<NewCookie> newCookies
           
protected  CaseInsensitiveMap outputHeaders
           
protected  boolean sentError
           
protected  int status
           
 
Constructor Summary
MockHttpResponse()
           
 
Method Summary
 void addNewCookie(NewCookie cookie)
           
 String getContentAsString()
           
 String getErrorMessage()
           
 List<NewCookie> getNewCookies()
           
 byte[] getOutput()
           
 MultivaluedMap<String,Object> getOutputHeaders()
           
 OutputStream getOutputStream()
           
 int getStatus()
           
 boolean isCommitted()
           
 boolean isErrorSent()
           
 void reset()
          reset status and headers.
 void sendError(int status)
           
 void sendError(int status, String message)
           
 void setStatus(int status)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

status

protected int status

baos

protected ByteArrayOutputStream baos

outputHeaders

protected CaseInsensitiveMap outputHeaders

newCookies

protected List<NewCookie> newCookies

errorMessage

protected String errorMessage

sentError

protected boolean sentError
Constructor Detail

MockHttpResponse

public MockHttpResponse()
Method Detail

getStatus

public int getStatus()
Specified by:
getStatus in interface HttpResponse

setStatus

public void setStatus(int status)
Specified by:
setStatus in interface HttpResponse

getOutputHeaders

public MultivaluedMap<String,Object> getOutputHeaders()
Specified by:
getOutputHeaders in interface HttpResponse

getOutputStream

public OutputStream getOutputStream()
                             throws IOException
Specified by:
getOutputStream in interface HttpResponse
Throws:
IOException

getOutput

public byte[] getOutput()

getContentAsString

public String getContentAsString()

addNewCookie

public void addNewCookie(NewCookie cookie)
Specified by:
addNewCookie in interface HttpResponse

sendError

public void sendError(int status)
               throws IOException
Specified by:
sendError in interface HttpResponse
Throws:
IOException

sendError

public void sendError(int status,
                      String message)
               throws IOException
Specified by:
sendError in interface HttpResponse
Throws:
IOException

getNewCookies

public List<NewCookie> getNewCookies()

getErrorMessage

public String getErrorMessage()

isErrorSent

public boolean isErrorSent()

isCommitted

public boolean isCommitted()
Specified by:
isCommitted in interface HttpResponse

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


Copyright © 2011. All Rights Reserved.