|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.click.servlet.MockResponse
Mock implementation of HttpServletResponse.
| Field Summary |
| Constructor Summary | |
MockResponse()
Create the response object. |
|
| Method Summary | |
void |
addCookie(Cookie cookie)
Add a cookie to the response. |
void |
addDateHeader(String name,
long l)
Add a date header. |
void |
addHeader(String name,
String value)
Add the given header value, including an additional entry if one already exists. |
void |
addIntHeader(String name,
int i)
Add an int header value. |
static void |
append2digits(StringBuffer buf,
int i)
Append two digits if specified int is less than 100. |
boolean |
containsHeader(String name)
Check if the response contains the given header name. |
String |
encodeRedirectUrl(String url)
Encode the redirectUrl. |
String |
encodeRedirectURL(String url)
Encode the redirectUrl. |
String |
encodeUrl(String url)
Encode thr URL. |
String |
encodeURL(String url)
Encode thr URL. |
void |
flushBuffer()
Flush the buffer. |
static String |
formatDate(long value)
Formats the specified long value as a date. |
static void |
formatDate(StringBuffer buf,
Calendar calendar,
boolean cookie)
Format HTTP date "EEE, dd MMM yyyy HH:mm:ss 'GMT'" or "EEE, dd-MMM-yy HH:mm:ss 'GMT'" for cookies. |
byte[] |
getBinaryContent()
Get the binary content that was written to the servlet stream. |
int |
getBufferSize()
Return the current buffer size. |
String |
getCharacterEncoding()
Get the character encoding of the response. |
int |
getCode()
Get the response code for this request. |
String |
getContentType()
Return the response content type. |
Collection |
getCookies()
Get all of the cookies that have been added to the response. |
String |
getDocument()
Get the text document that was written as part of this response. |
String |
getErrorMessage()
Get the error message. |
String |
getHeader(String name)
Return the value of the given named header. |
Set |
getHeaderNames()
Get the names of all of the headers. |
Locale |
getLocale()
Get the encoded locale. |
ServletOutputStream |
getOutputStream()
Get the output stream for writing binary data from the servlet. |
String |
getRedirectUrl()
Get the location that was redirected to. |
int |
getStatus()
Get the status code. |
PrintWriter |
getWriter()
Get the print writer for writing text output for this response. |
void |
initialize()
Reset the response ready for reuse. |
boolean |
isCommitted()
Always returns false. |
boolean |
isError()
Return whether the servlet returned an error code or not. |
boolean |
isRedirect()
Check whether the response was redirected or not. |
void |
reset()
Delegate to initialise method. |
void |
resetBuffer()
Clears the buffer. |
void |
sendError(int code)
Send an error code. |
void |
sendError(int code,
String msg)
Send an error code. |
void |
sendRedirect(String url)
Indicate sending of a redirectUrl to a particular named resource. |
void |
setBufferSize(int size)
Method ignored. |
void |
setCharacterEncoding(String characterEncoding)
Set the character encoding. |
void |
setContentLength(int length)
Set the content length. |
void |
setContentType(String type)
Set the content type. |
void |
setDateHeader(String name,
long l)
Set a date header. |
void |
setHeader(String name,
String value)
Set the given header value. |
void |
setIntHeader(String name,
int i)
Set an int header value. |
void |
setLocale(Locale locale)
Set the locale in the response header. |
void |
setStatus(int status)
Set the status for this response. |
void |
setStatus(int status,
String msg)
Deprecated. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public MockResponse()
| Method Detail |
public void addCookie(Cookie cookie)
addCookie in interface HttpServletResponsecookie - The cookie to add
public void addDateHeader(String name,
long l)
addDateHeader in interface HttpServletResponsename - The header valuel - The long value
public void addHeader(String name,
String value)
addHeader in interface HttpServletResponsename - The name for the headervalue - The value for the header
public void addIntHeader(String name,
int i)
addIntHeader in interface HttpServletResponsename - The header namei - The valuepublic boolean containsHeader(String name)
containsHeader in interface HttpServletResponsename - The name to check
public String encodeRedirectUrl(String url)
encodeRedirectUrl in interface HttpServletResponseurl - The url to encode
public String encodeRedirectURL(String url)
encodeRedirectURL in interface HttpServletResponseurl - The url to encode
public String encodeUrl(String url)
encodeUrl in interface HttpServletResponseurl - The url to encode
public String encodeURL(String url)
encodeURL in interface HttpServletResponseurl - The url to encode
public void flushBuffer()
throws IOException
flushBuffer in interface ServletResponseIOException - if exception occurs during flushpublic byte[] getBinaryContent()
public int getBufferSize()
getBufferSize in interface ServletResponsepublic String getCharacterEncoding()
getCharacterEncoding in interface ServletResponsepublic int getCode()
public Collection getCookies()
public String getDocument()
public String getErrorMessage()
public String getHeader(String name)
name - The header name
public Set getHeaderNames()
public Locale getLocale()
getLocale in interface ServletResponsepublic ServletOutputStream getOutputStream()
getOutputStream in interface ServletResponsepublic String getRedirectUrl()
public int getStatus()
public PrintWriter getWriter()
throws IOException
getWriter in interface ServletResponseIOException - - if an input or output exception occurred
IllegalStateException - - if the getOutputStream method has
already been called for this response objectpublic void initialize()
public void reset()
reset in interface ServletResponsepublic boolean isCommitted()
isCommitted in interface ServletResponsepublic boolean isError()
public boolean isRedirect()
public void resetBuffer()
resetBuffer in interface ServletResponse
public void sendError(int code)
throws IOException
sendError in interface HttpServletResponsecode - The code
IOException - Not used
public void sendError(int code,
String msg)
throws IOException
sendError in interface HttpServletResponsecode - The error codemsg - The error message
IOException - Not used
public void sendRedirect(String url)
throws IOException
sendRedirect in interface HttpServletResponseurl - The url to set redirectUrl to
IOException - Not usedpublic void setBufferSize(int size)
setBufferSize in interface ServletResponsesize - The sizepublic void setCharacterEncoding(String characterEncoding)
characterEncoding - The character encodingpublic void setContentLength(int length)
setContentLength in interface ServletResponselength - The lengthpublic void setContentType(String type)
setContentType in interface ServletResponsetype - The content typepublic String getContentType()
public void setDateHeader(String name,
long l)
setDateHeader in interface HttpServletResponsename - The header namel - The long valuepublic static String formatDate(long value)
value - the specified long value to format
public static void formatDate(StringBuffer buf,
Calendar calendar,
boolean cookie)
buf - the buffer to render to formatted date tocalendar - the date to formatcookie - should date be formatted for usage in a cookie
public static void append2digits(StringBuffer buf,
int i)
buf - the buffer to add 2 digits toi - the digits to add
public void setHeader(String name,
String value)
setHeader in interface HttpServletResponsename - The name for the headervalue - The value for the header
public void setIntHeader(String name,
int i)
setIntHeader in interface HttpServletResponsename - The header namei - The valuepublic void setLocale(Locale locale)
setLocale in interface ServletResponselocale - The localepublic void setStatus(int status)
setStatus in interface HttpServletResponsestatus - The status
public void setStatus(int status,
String msg)
setStatus in interface HttpServletResponsestatus - The statusmsg - The message
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||