|
Fish & Chips Club 4.10.0.0 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Objecthirondelle.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 ServletResponsepublic void setCharacterEncoding(String aEncoding)
setCharacterEncoding in interface ServletResponsepublic String getContentType()
getContentType in interface ServletResponsepublic void setContentType(String aContentType)
setContentType in interface ServletResponsepublic Locale getLocale()
getLocale in interface ServletResponsepublic void setLocale(Locale aLocale)
setLocale in interface ServletResponse
public ServletOutputStream getOutputStream()
throws IOException
getOutputStream in interface ServletResponseIOException
public PrintWriter getWriter()
throws IOException
getWriter in interface ServletResponseIOExceptionpublic void setContentLength(int aLength)
setContentLength in interface ServletResponsepublic int getBufferSize()
getBufferSize in interface ServletResponsepublic void setBufferSize(int aBufferSize)
setBufferSize in interface ServletResponse
public void flushBuffer()
throws IOException
flushBuffer in interface ServletResponseIOExceptionpublic void resetBuffer()
resetBuffer in interface ServletResponsepublic boolean isCommitted()
isCommitted in interface ServletResponsepublic void reset()
reset in interface ServletResponsepublic void addCookie(Cookie aCookie)
addCookie in interface HttpServletResponsepublic void setStatus(int aStatusCode)
setStatus in interface HttpServletResponse
public void setStatus(int aStatusCode,
String aStatusMessage)
setStatus in interface HttpServletResponsepublic 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 HttpServletResponsepublic String encodeURL(String aURL)
encodeURL in interface HttpServletResponsepublic String encodeRedirectURL(String aURL)
encodeRedirectURL in interface HttpServletResponsepublic String encodeUrl(String arg0)
encodeUrl in interface HttpServletResponsepublic String encodeRedirectUrl(String arg0)
encodeRedirectUrl in interface HttpServletResponse
public void sendError(int aStatusCode)
throws IOException
sendError in interface HttpServletResponseIOException
public void sendError(int aStatusCode,
String aMessage)
throws IOException
sendError in interface HttpServletResponseIOException
public void sendRedirect(String aLocation)
throws IOException
sendRedirect in interface HttpServletResponseIOException
|
Fish & Chips Club 4.10.0.0 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||