|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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 HttpServletResponse
public boolean containsHeader(String name)
containsHeader
in interface HttpServletResponse
public String encodeRedirectUrl(String url)
encodeRedirectUrl
in interface HttpServletResponse
public String encodeRedirectURL(String url)
encodeRedirectURL
in interface HttpServletResponse
public String encodeUrl(String url)
encodeUrl
in interface HttpServletResponse
public String encodeURL(String url)
encodeURL
in interface HttpServletResponse
public void sendError(int status)
sendError
in interface HttpServletResponse
public void sendError(int status, String message)
sendError
in interface HttpServletResponse
public 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 HttpServletResponse
public void setStatus(int status)
setStatus
in interface HttpServletResponse
public void setStatus(int status, String message)
setStatus
in interface HttpServletResponse
public void flushBuffer()
flushBuffer
in interface ServletResponse
public int getBufferSize()
getBufferSize
in interface ServletResponse
public String getCharacterEncoding()
getCharacterEncoding
in interface ServletResponse
public String getContentType()
getContentType
in interface ServletResponse
public Locale getLocale()
getLocale
in interface ServletResponse
public ServletOutputStream getOutputStream() throws IOException
getOutputStream
in interface ServletResponse
IOException
public PrintWriter getWriter() throws IOException
getWriter
in interface ServletResponse
IOException
public boolean isCommitted()
isCommitted
in interface ServletResponse
public void reset()
reset
in interface ServletResponse
public void resetBuffer()
resetBuffer
in interface ServletResponse
public void setBufferSize(int size)
setBufferSize
in interface ServletResponse
public void setCharacterEncoding(String charset)
setCharacterEncoding
in interface ServletResponse
public void setContentLength(int length)
setContentLength
in interface ServletResponse
public void setContentType(String type)
setContentType
in interface ServletResponse
public void setLocale(Locale locale)
setLocale
in interface ServletResponse
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |