|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.slim3.struts.test.MockHttpServletResponse
public class MockHttpServletResponse
A mock implementation for MockHttpServletResponse.
| Field Summary | |
|---|---|
protected int |
bufferSize
The buffer size. |
protected String |
characterEncoding
The character encoding. |
protected boolean |
committed
The committed flag. |
protected List<Cookie> |
cookieList
The list for Cookie. |
protected boolean |
getOutputStreamCalled
Whether getOutputStream method is called. |
protected boolean |
getWriterCalled
Whether getWriter method is called. |
protected Map<String,List<String>> |
headerMap
The map for the response header. |
protected Locale |
locale
The locale. |
protected String |
message
The message. |
protected ServletOutputStream |
outputStream
The output stream. |
protected ByteArrayOutputStream |
sourceOutput
The source output. |
protected int |
status
The status. |
protected PrintWriter |
writer
The writer. |
| Constructor Summary | |
|---|---|
MockHttpServletResponse()
Constructor. |
|
| Method Summary | |
|---|---|
void |
addCookie(Cookie cookie)
|
void |
addDateHeader(String name,
long value)
|
void |
addHeader(String name,
String value)
|
void |
addIntHeader(String name,
int value)
|
protected void |
assertNotCommitted()
Asserts this response is not committed. |
boolean |
containsHeader(String name)
|
String |
encodeRedirectUrl(String url)
|
String |
encodeRedirectURL(String url)
|
String |
encodeUrl(String url)
|
String |
encodeURL(String url)
|
void |
flushBuffer()
|
int |
getBufferSize()
|
String |
getCharacterEncoding()
|
int |
getContentLength()
Returns the content length. |
String |
getContentType()
|
Cookie[] |
getCookies()
Returns the cookies. |
long |
getDateHeader(String name)
Returns the header as date. |
String |
getHeader(String name)
Returns the header as string. |
protected List<String> |
getHeaderList(String name)
Returns the header as list. |
Enumeration<String> |
getHeaderNames()
Returns the header names. |
Enumeration<String> |
getHeaders(String name)
Returns the header as Enumeration. |
int |
getIntHeader(String name)
Returns the header as int. |
Locale |
getLocale()
|
String |
getMessage()
Returns the message. |
byte[] |
getOutputAsByteArray()
Returns the output as array of bytes. |
String |
getOutputAsString()
Returns the output as string. |
ServletOutputStream |
getOutputStream()
|
protected String |
getResponseStatusMessage(int status)
Returns the response status message. |
int |
getStatus()
Returns the status. |
PrintWriter |
getWriter()
|
boolean |
isCommitted()
|
void |
reset()
|
void |
resetBuffer()
|
void |
sendError(int status)
|
void |
sendError(int status,
String message)
|
void |
sendRedirect(String path)
|
void |
setBufferSize(int bufferSize)
|
void |
setCharacterEncoding(String characterEncoding)
|
void |
setContentLength(int contentLength)
|
void |
setContentType(String contentType)
|
void |
setDateHeader(String name,
long value)
|
void |
setHeader(String name,
String value)
|
void |
setIntHeader(String name,
int value)
|
void |
setLocale(Locale locale)
|
void |
setStatus(int status)
|
void |
setStatus(int status,
String message)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected List<Cookie> cookieList
Cookie.
protected Map<String,List<String>> headerMap
protected boolean committed
protected int status
protected String message
protected Locale locale
protected String characterEncoding
protected ByteArrayOutputStream sourceOutput
protected PrintWriter writer
protected ServletOutputStream outputStream
protected boolean getWriterCalled
protected boolean getOutputStreamCalled
protected int bufferSize
| Constructor Detail |
|---|
public MockHttpServletResponse()
| Method Detail |
|---|
public Cookie[] getCookies()
public void addCookie(Cookie cookie)
addCookie in interface HttpServletResponsepublic boolean containsHeader(String name)
containsHeader in interface HttpServletResponsepublic String encodeURL(String url)
encodeURL in interface HttpServletResponsepublic String encodeRedirectURL(String url)
encodeRedirectURL in interface HttpServletResponsepublic String encodeUrl(String url)
encodeUrl in interface HttpServletResponsepublic String encodeRedirectUrl(String url)
encodeRedirectUrl in interface HttpServletResponsepublic int getStatus()
public void setStatus(int status,
String message)
setStatus in interface HttpServletResponsepublic void setStatus(int status)
setStatus in interface HttpServletResponseprotected String getResponseStatusMessage(int status)
status - the status
protected void assertNotCommitted()
public String getMessage()
public void sendError(int status,
String message)
throws IOException
sendError in interface HttpServletResponseIOException
public void sendError(int status)
throws IOException
sendError in interface HttpServletResponseIOException
public void sendRedirect(String path)
throws IOException
sendRedirect in interface HttpServletResponseIOExceptionpublic Enumeration<String> getHeaders(String name)
Enumeration.
name - the name
public String getHeader(String name)
name - the name
public long getDateHeader(String name)
name - the name
public int getIntHeader(String name)
name - the name
protected List<String> getHeaderList(String name)
name - the name
public Enumeration<String> getHeaderNames()
public void setHeader(String name,
String value)
setHeader in interface HttpServletResponse
public void addHeader(String name,
String value)
addHeader in interface HttpServletResponse
public void setDateHeader(String name,
long value)
setDateHeader in interface HttpServletResponse
public void addDateHeader(String name,
long value)
addDateHeader in interface HttpServletResponse
public void setIntHeader(String name,
int value)
setIntHeader in interface HttpServletResponse
public void addIntHeader(String name,
int value)
addIntHeader in interface HttpServletResponsepublic int getContentLength()
public void setContentLength(int contentLength)
setContentLength in interface ServletResponsepublic String getContentType()
getContentType in interface ServletResponsepublic void setContentType(String contentType)
setContentType in interface ServletResponsepublic String getCharacterEncoding()
getCharacterEncoding in interface ServletResponsepublic void setCharacterEncoding(String characterEncoding)
setCharacterEncoding in interface ServletResponse
public ServletOutputStream getOutputStream()
throws IOException
getOutputStream in interface ServletResponseIOException
public PrintWriter getWriter()
throws IOException
getWriter in interface ServletResponseIOException
public byte[] getOutputAsByteArray()
throws IOException
IOException - if IOException is encountered
public String getOutputAsString()
throws IOException
IOException - if IOException is encounteredpublic int getBufferSize()
getBufferSize in interface ServletResponsepublic void setBufferSize(int bufferSize)
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 setLocale(Locale locale)
setLocale in interface ServletResponsepublic Locale getLocale()
getLocale in interface ServletResponse
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||