|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.shale.test.mock.MockHttpServletResponse
public class MockHttpServletResponse
Mock implementation of HttpServletResponse.
| Field Summary |
|---|
| Constructor Summary | |
|---|---|
MockHttpServletResponse()
Return a default instance. |
|
| Method Summary | |
|---|---|
void |
addCookie(Cookie cookie)
|
void |
addDateHeader(String name,
long value)
|
void |
addHeader(String name,
String value)
|
void |
addIntHeader(String name,
int value)
|
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()
|
String |
getContentType()
|
String |
getHeader(String name)
Retrieve the first value that was set for the specified header, if any. |
Locale |
getLocale()
|
String |
getMessage()
Return the text message for the HTTP status that was set. |
ServletOutputStream |
getOutputStream()
|
int |
getStatus()
Return the HTTP status code that was set. |
PrintWriter |
getWriter()
|
boolean |
isCommitted()
|
void |
reset()
|
void |
resetBuffer()
|
void |
sendError(int status)
|
void |
sendError(int status,
String message)
|
void |
sendRedirect(String location)
|
void |
setBufferSize(int size)
|
void |
setCharacterEncoding(String charset)
|
void |
setContentLength(int length)
|
void |
setContentType(String type)
|
void |
setDateHeader(String name,
long value)
|
void |
setHeader(String name,
String value)
|
void |
setIntHeader(String name,
int value)
|
void |
setLocale(Locale locale)
|
void |
setOutputStream(ServletOutputStream stream)
Deprecated. Let the getOutputStream() method create and
return an instance of MockServletOutputStream for you |
void |
setStatus(int status)
|
void |
setStatus(int status,
String message)
|
void |
setWriter(PrintWriter writer)
Deprecated. Let the getWriter() method create and return
an instance of MockPrintWriter for you |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MockHttpServletResponse()
Return a default instance.
| Method Detail |
|---|
public String getHeader(String name)
Retrieve the first value that was set for the specified header,
if any. Otherwise, return null.
name - Header name to look uppublic String getMessage()
Return the text message for the HTTP status that was set.
public int getStatus()
Return the HTTP status code that was set.
public void setOutputStream(ServletOutputStream stream)
getOutputStream() method create and
return an instance of MockServletOutputStream for you
Set the ServletOutputStream to be returned by a call to
getOutputStream().
stream - The ServletOutputStream instance to usepublic void setWriter(PrintWriter writer)
getWriter() method create and return
an instance of MockPrintWriter for you
Set the PrintWriter to be returned by a call to
getWriter().
writer - The PrintWriter instance to usepublic void addCookie(Cookie cookie)
addCookie in interface HttpServletResponse
public void addDateHeader(String name,
long value)
addDateHeader in interface HttpServletResponse
public void addHeader(String name,
String value)
addHeader in interface HttpServletResponse
public void addIntHeader(String name,
int value)
addIntHeader in interface HttpServletResponsepublic boolean containsHeader(String name)
containsHeader in interface HttpServletResponsepublic String encodeRedirectUrl(String url)
encodeRedirectUrl in interface HttpServletResponsepublic String encodeRedirectURL(String url)
encodeRedirectURL in interface HttpServletResponsepublic String encodeUrl(String url)
encodeUrl in interface HttpServletResponsepublic String encodeURL(String url)
encodeURL in interface HttpServletResponsepublic void sendError(int status)
sendError in interface HttpServletResponse
public void sendError(int status,
String message)
sendError in interface HttpServletResponsepublic void sendRedirect(String location)
sendRedirect in interface HttpServletResponse
public void setDateHeader(String name,
long value)
setDateHeader in interface HttpServletResponse
public void setHeader(String name,
String value)
setHeader in interface HttpServletResponse
public void setIntHeader(String name,
int value)
setIntHeader in interface HttpServletResponsepublic void setStatus(int status)
setStatus in interface HttpServletResponse
public void setStatus(int status,
String message)
setStatus in interface HttpServletResponsepublic void flushBuffer()
flushBuffer in interface ServletResponsepublic int getBufferSize()
getBufferSize in interface ServletResponsepublic String getCharacterEncoding()
getCharacterEncoding in interface ServletResponsepublic String getContentType()
getContentType in interface ServletResponsepublic Locale getLocale()
getLocale in interface ServletResponse
public ServletOutputStream getOutputStream()
throws IOException
getOutputStream in interface ServletResponseIOException
public PrintWriter getWriter()
throws IOException
getWriter in interface ServletResponseIOExceptionpublic boolean isCommitted()
isCommitted in interface ServletResponsepublic void reset()
reset in interface ServletResponsepublic void resetBuffer()
resetBuffer in interface ServletResponsepublic void setBufferSize(int size)
setBufferSize in interface ServletResponsepublic void setCharacterEncoding(String charset)
setCharacterEncoding in interface ServletResponsepublic void setContentLength(int length)
setContentLength in interface ServletResponsepublic void setContentType(String type)
setContentType in interface ServletResponsepublic void setLocale(Locale locale)
setLocale in interface ServletResponse
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||