public class MockHttpResponse extends Object implements HttpResponse
Modifier and Type | Field and Description |
---|---|
protected ByteArrayOutputStream |
baos |
protected String |
errorMessage |
protected List<NewCookie> |
newCookies |
protected OutputStream |
os |
protected CaseInsensitiveMap |
outputHeaders |
protected boolean |
sentError |
protected int |
status |
Constructor and Description |
---|
MockHttpResponse() |
Modifier and Type | Method and Description |
---|---|
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 |
setOutputStream(OutputStream os) |
void |
setStatus(int status) |
protected int status
protected ByteArrayOutputStream baos
protected OutputStream os
protected CaseInsensitiveMap outputHeaders
protected String errorMessage
protected boolean sentError
public int getStatus()
getStatus
in interface HttpResponse
public void setStatus(int status)
setStatus
in interface HttpResponse
public MultivaluedMap<String,Object> getOutputHeaders()
getOutputHeaders
in interface HttpResponse
public OutputStream getOutputStream() throws IOException
getOutputStream
in interface HttpResponse
IOException
public void setOutputStream(OutputStream os)
setOutputStream
in interface HttpResponse
public byte[] getOutput()
public String getContentAsString()
public void addNewCookie(NewCookie cookie)
addNewCookie
in interface HttpResponse
public void sendError(int status) throws IOException
sendError
in interface HttpResponse
IOException
public void sendError(int status, String message) throws IOException
sendError
in interface HttpResponse
IOException
public String getErrorMessage()
public boolean isErrorSent()
public boolean isCommitted()
isCommitted
in interface HttpResponse
public void reset()
HttpResponse
reset
in interface HttpResponse
Copyright © 2014. All Rights Reserved.