Package org.jboss.resteasy.mock
Class MockHttpResponse
- java.lang.Object
-
- org.jboss.resteasy.mock.MockHttpResponse
-
- All Implemented Interfaces:
Closeable,AutoCloseable,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
Fields Modifier and Type Field Description protected ByteArrayOutputStreambaosprotected StringerrorMessageprotected List<javax.ws.rs.core.NewCookie>newCookiesprotected OutputStreamosprotected CaseInsensitiveMap<Object>outputHeadersprotected booleansentErrorprotected intstatus
-
Constructor Summary
Constructors Constructor Description MockHttpResponse()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddNewCookie(javax.ws.rs.core.NewCookie cookie)voidflushBuffer()StringgetContentAsString()StringgetErrorMessage()List<javax.ws.rs.core.NewCookie>getNewCookies()byte[]getOutput()javax.ws.rs.core.MultivaluedMap<String,Object>getOutputHeaders()OutputStreamgetOutputStream()intgetStatus()booleanisCommitted()booleanisErrorSent()voidreset()reset status and headers.voidsendError(int status)voidsendError(int status, String message)voidsetOutputStream(OutputStream os)voidsetStatus(int status)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jboss.resteasy.spi.HttpResponse
close, getAsyncOutputStream, setSuppressExceptionDuringChunkedTransfer, suppressExceptionDuringChunkedTransfer
-
-
-
-
Field Detail
-
status
protected int status
-
baos
protected ByteArrayOutputStream baos
-
os
protected OutputStream os
-
outputHeaders
protected CaseInsensitiveMap<Object> outputHeaders
-
newCookies
protected List<javax.ws.rs.core.NewCookie> newCookies
-
errorMessage
protected String errorMessage
-
sentError
protected boolean sentError
-
-
Method Detail
-
getStatus
public int getStatus()
- Specified by:
getStatusin interfaceHttpResponse
-
setStatus
public void setStatus(int status)
- Specified by:
setStatusin interfaceHttpResponse
-
getOutputHeaders
public javax.ws.rs.core.MultivaluedMap<String,Object> getOutputHeaders()
- Specified by:
getOutputHeadersin interfaceHttpResponse
-
getOutputStream
public OutputStream getOutputStream() throws IOException
- Specified by:
getOutputStreamin interfaceHttpResponse- Throws:
IOException
-
setOutputStream
public void setOutputStream(OutputStream os)
- Specified by:
setOutputStreamin interfaceHttpResponse
-
getOutput
public byte[] getOutput()
-
getContentAsString
public String getContentAsString() throws UnsupportedEncodingException
- Throws:
UnsupportedEncodingException
-
addNewCookie
public void addNewCookie(javax.ws.rs.core.NewCookie cookie)
- Specified by:
addNewCookiein interfaceHttpResponse
-
sendError
public void sendError(int status) throws IOException- Specified by:
sendErrorin interfaceHttpResponse- Throws:
IOException
-
sendError
public void sendError(int status, String message) throws IOException- Specified by:
sendErrorin interfaceHttpResponse- Throws:
IOException
-
getNewCookies
public List<javax.ws.rs.core.NewCookie> getNewCookies()
-
getErrorMessage
public String getErrorMessage()
-
isErrorSent
public boolean isErrorSent()
-
isCommitted
public boolean isCommitted()
- Specified by:
isCommittedin interfaceHttpResponse
-
reset
public void reset()
Description copied from interface:HttpResponsereset status and headers. Will fail if response is committed- Specified by:
resetin interfaceHttpResponse
-
flushBuffer
public void flushBuffer() throws IOException- Specified by:
flushBufferin interfaceHttpResponse- Throws:
IOException
-
-