|
Fish & Chips Club 4.10.0.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object hirondelle.fish.test.doubles.FakeResponse
public final class FakeResponse
Fake implementation of HttpServletResponse
, used
only for testing outside of the regular runtime environment.
Internally, a fake ServletOutputStream
is used here, which simply
places the response data in a simple byte array held in memory, with no
other ultimate destination such as a file or another stream.
Thus, flush and close are no-operations, and
there is no reason to use buffering with such a stream.
Methods associated with buffering are no-operations.
Nested Class Summary | |
---|---|
static class |
FakeResponse.Header
Holds simple name-value pairs. |
Field Summary |
---|
Constructor Summary | |
---|---|
FakeResponse()
|
Method Summary | |
---|---|
void |
addCookie(Cookie aCookie)
|
void |
addDateHeader(String aName,
long aValue)
|
void |
addHeader(String aName,
String aValue)
|
void |
addIntHeader(String aName,
int aValue)
|
boolean |
containsHeader(String aName)
|
String |
encodeRedirectUrl(String arg0)
Deprecated. |
String |
encodeRedirectURL(String aURL)
Returns the argument unchanged. |
String |
encodeUrl(String arg0)
Deprecated. |
String |
encodeURL(String aURL)
Returns the argument unchanged. |
void |
flushBuffer()
No-operation. |
int |
getBufferSize()
|
String |
getCharacterEncoding()
|
String |
getContentType()
|
List<Cookie> |
getCookies()
Return the cookies that have been passed to this object. |
String |
getFinalResponse(String aEncoding)
Return the response as a String. |
byte[] |
getFinalResponseAsBytes()
Return the response as a byte[]. |
List<FakeResponse.Header> |
getHeaders()
Return all headers associated with the response. |
Locale |
getLocale()
|
ServletOutputStream |
getOutputStream()
|
int |
getStatus()
Return the response status code. |
PrintWriter |
getWriter()
|
boolean |
isCommitted()
Returns true is anything has been written to the in-memory stream. |
void |
reset()
No-operation. |
void |
resetBuffer()
No-operation. |
void |
sendError(int aStatusCode)
|
void |
sendError(int aStatusCode,
String aMessage)
|
void |
sendRedirect(String aLocation)
|
void |
setBufferSize(int aBufferSize)
|
void |
setCharacterEncoding(String aEncoding)
|
void |
setContentLength(int aLength)
No-operation. |
void |
setContentType(String aContentType)
|
void |
setDateHeader(String aName,
long aValue)
|
void |
setHeader(String aName,
String aValue)
|
void |
setIntHeader(String aName,
int aValue)
|
void |
setLocale(Locale aLocale)
Does not set the character encoding. |
void |
setStatus(int aStatusCode)
|
void |
setStatus(int aStatusCode,
String aStatusMessage)
Not implemented - deprecated. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FakeResponse()
Method Detail |
---|
public String getFinalResponse(String aEncoding)
public byte[] getFinalResponseAsBytes()
public List<Cookie> getCookies()
public int getStatus()
public List<FakeResponse.Header> getHeaders()
public String getCharacterEncoding()
getCharacterEncoding
in interface ServletResponse
public void setCharacterEncoding(String aEncoding)
setCharacterEncoding
in interface ServletResponse
public String getContentType()
getContentType
in interface ServletResponse
public void setContentType(String aContentType)
setContentType
in interface ServletResponse
public Locale getLocale()
getLocale
in interface ServletResponse
public void setLocale(Locale aLocale)
setLocale
in interface ServletResponse
public ServletOutputStream getOutputStream() throws IOException
getOutputStream
in interface ServletResponse
IOException
public PrintWriter getWriter() throws IOException
getWriter
in interface ServletResponse
IOException
public void setContentLength(int aLength)
setContentLength
in interface ServletResponse
public int getBufferSize()
getBufferSize
in interface ServletResponse
public void setBufferSize(int aBufferSize)
setBufferSize
in interface ServletResponse
public void flushBuffer() throws IOException
flushBuffer
in interface ServletResponse
IOException
public void resetBuffer()
resetBuffer
in interface ServletResponse
public boolean isCommitted()
isCommitted
in interface ServletResponse
public void reset()
reset
in interface ServletResponse
public void addCookie(Cookie aCookie)
addCookie
in interface HttpServletResponse
public void setStatus(int aStatusCode)
setStatus
in interface HttpServletResponse
public void setStatus(int aStatusCode, String aStatusMessage)
setStatus
in interface HttpServletResponse
public boolean containsHeader(String aName)
containsHeader
in interface HttpServletResponse
public void addHeader(String aName, String aValue)
addHeader
in interface HttpServletResponse
public void setHeader(String aName, String aValue)
setHeader
in interface HttpServletResponse
public void addIntHeader(String aName, int aValue)
addIntHeader
in interface HttpServletResponse
public void setIntHeader(String aName, int aValue)
setIntHeader
in interface HttpServletResponse
public void addDateHeader(String aName, long aValue)
addDateHeader
in interface HttpServletResponse
public void setDateHeader(String aName, long aValue)
setDateHeader
in interface HttpServletResponse
public String encodeURL(String aURL)
encodeURL
in interface HttpServletResponse
public String encodeRedirectURL(String aURL)
encodeRedirectURL
in interface HttpServletResponse
public String encodeUrl(String arg0)
encodeUrl
in interface HttpServletResponse
public String encodeRedirectUrl(String arg0)
encodeRedirectUrl
in interface HttpServletResponse
public void sendError(int aStatusCode) throws IOException
sendError
in interface HttpServletResponse
IOException
public void sendError(int aStatusCode, String aMessage) throws IOException
sendError
in interface HttpServletResponse
IOException
public void sendRedirect(String aLocation) throws IOException
sendRedirect
in interface HttpServletResponse
IOException
|
Fish & Chips Club 4.10.0.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |