|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object wicket.protocol.http.MockHttpServletResponse
public class MockHttpServletResponse
Mock servlet response. Implements all of the methods from the standard HttpServletResponse class plus helper methods to aid viewing the generated response.
Field Summary |
---|
Fields inherited from interface javax.servlet.http.HttpServletResponse |
---|
SC_ACCEPTED, SC_BAD_GATEWAY, SC_BAD_REQUEST, SC_CONFLICT, SC_CONTINUE, SC_CREATED, SC_EXPECTATION_FAILED, SC_FORBIDDEN, SC_GATEWAY_TIMEOUT, SC_GONE, SC_HTTP_VERSION_NOT_SUPPORTED, SC_INTERNAL_SERVER_ERROR, SC_LENGTH_REQUIRED, SC_METHOD_NOT_ALLOWED, SC_MOVED_PERMANENTLY, SC_MOVED_TEMPORARILY, SC_MULTIPLE_CHOICES, SC_NO_CONTENT, SC_NON_AUTHORITATIVE_INFORMATION, SC_NOT_ACCEPTABLE, SC_NOT_FOUND, SC_NOT_IMPLEMENTED, SC_NOT_MODIFIED, SC_OK, SC_PARTIAL_CONTENT, SC_PAYMENT_REQUIRED, SC_PRECONDITION_FAILED, SC_PROXY_AUTHENTICATION_REQUIRED, SC_REQUEST_ENTITY_TOO_LARGE, SC_REQUEST_TIMEOUT, SC_REQUEST_URI_TOO_LONG, SC_REQUESTED_RANGE_NOT_SATISFIABLE, SC_RESET_CONTENT, SC_SEE_OTHER, SC_SERVICE_UNAVAILABLE, SC_SWITCHING_PROTOCOLS, SC_TEMPORARY_REDIRECT, SC_UNAUTHORIZED, SC_UNSUPPORTED_MEDIA_TYPE, SC_USE_PROXY |
Constructor Summary | |
---|---|
MockHttpServletResponse()
Create the response object. |
Method Summary | |
---|---|
void |
addCookie(javax.servlet.http.Cookie cookie)
Add a cookie to the response. |
void |
addDateHeader(java.lang.String name,
long l)
Add a date header. |
void |
addHeader(java.lang.String name,
java.lang.String value)
Add the given header value, including an additional entry if one already exists. |
void |
addIntHeader(java.lang.String name,
int i)
Add an int header value. |
boolean |
containsHeader(java.lang.String name)
Check if the response contains the given header name. |
java.lang.String |
encodeRedirectUrl(java.lang.String url)
Encode the redirectLocation URL. |
java.lang.String |
encodeRedirectURL(java.lang.String url)
Encode the redirectLocation URL. |
java.lang.String |
encodeUrl(java.lang.String url)
Encode thr URL. |
java.lang.String |
encodeURL(java.lang.String url)
Encode thr URL. |
void |
flushBuffer()
Flush the buffer. |
byte[] |
getBinaryContent()
Get the binary content that was written to the servlet stream. |
int |
getBufferSize()
Return the current buffer size |
java.lang.String |
getCharacterEncoding()
Get the character encoding of the response. |
int |
getCode()
Get the response code for this request. |
java.util.Collection |
getCookies()
Get all of the cookies that have been added to the response. |
java.lang.String |
getDocument()
Get the text document that was written as part of this response. |
java.lang.String |
getErrorMessage()
Get the error message. |
java.lang.String |
getHeader(java.lang.String name)
Return the value of the given named header. |
java.util.Set |
getHeaderNames()
Get the names of all of the headers. |
java.util.Locale |
getLocale()
Get the encoded locale |
javax.servlet.ServletOutputStream |
getOutputStream()
Get the output stream for writing binary data from the servlet. |
java.lang.String |
getRedirectLocation()
Get the location that was redirected to. |
int |
getStatus()
Get the status code. |
java.io.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,
java.lang.String msg)
Send an error code. |
void |
sendRedirect(java.lang.String location)
Indicate sending of a redirectLocation to a particular named resource. |
void |
setBufferSize(int size)
Method ignored. |
void |
setCharacterEncoding(java.lang.String characterEncoding)
Set the character encoding. |
void |
setContentLength(int length)
Set the content length. |
void |
setContentType(java.lang.String type)
Set the content type. |
void |
setDateHeader(java.lang.String name,
long l)
Set a date header. |
void |
setHeader(java.lang.String name,
java.lang.String value)
Set the given header value. |
void |
setIntHeader(java.lang.String name,
int i)
Set an int header value. |
void |
setLocale(java.util.Locale locale)
Set the locale in the response header. |
void |
setStatus(int status)
Set the status for this response. |
void |
setStatus(int status,
java.lang.String msg)
Deprecated. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MockHttpServletResponse()
Method Detail |
---|
public void addCookie(javax.servlet.http.Cookie cookie)
addCookie
in interface javax.servlet.http.HttpServletResponse
cookie
- The cookie to addpublic void addDateHeader(java.lang.String name, long l)
addDateHeader
in interface javax.servlet.http.HttpServletResponse
name
- The header valuel
- The long valuepublic void addHeader(java.lang.String name, java.lang.String value)
addHeader
in interface javax.servlet.http.HttpServletResponse
name
- The name for the headervalue
- The value for the headerpublic void addIntHeader(java.lang.String name, int i)
addIntHeader
in interface javax.servlet.http.HttpServletResponse
name
- The header namei
- The valuepublic boolean containsHeader(java.lang.String name)
containsHeader
in interface javax.servlet.http.HttpServletResponse
name
- The name to check
public java.lang.String encodeRedirectUrl(java.lang.String url)
encodeRedirectUrl
in interface javax.servlet.http.HttpServletResponse
url
- The url to encode
public java.lang.String encodeRedirectURL(java.lang.String url)
encodeRedirectURL
in interface javax.servlet.http.HttpServletResponse
url
- The url to encode
public java.lang.String encodeUrl(java.lang.String url)
encodeUrl
in interface javax.servlet.http.HttpServletResponse
url
- The url to encode
public java.lang.String encodeURL(java.lang.String url)
encodeURL
in interface javax.servlet.http.HttpServletResponse
url
- The url to encode
public void flushBuffer() throws java.io.IOException
flushBuffer
in interface javax.servlet.ServletResponse
java.io.IOException
public byte[] getBinaryContent()
public int getBufferSize()
getBufferSize
in interface javax.servlet.ServletResponse
public java.lang.String getCharacterEncoding()
getCharacterEncoding
in interface javax.servlet.ServletResponse
public int getCode()
public java.util.Collection getCookies()
public java.lang.String getDocument()
public java.lang.String getErrorMessage()
public java.lang.String getHeader(java.lang.String name)
name
- The header name
public java.util.Set getHeaderNames()
public java.util.Locale getLocale()
getLocale
in interface javax.servlet.ServletResponse
public javax.servlet.ServletOutputStream getOutputStream() throws java.io.IOException
getOutputStream
in interface javax.servlet.ServletResponse
java.io.IOException
- If stream not availablepublic java.lang.String getRedirectLocation()
public int getStatus()
public java.io.PrintWriter getWriter() throws java.io.IOException
getWriter
in interface javax.servlet.ServletResponse
java.io.IOException
- Not usedpublic void initialize()
public boolean isCommitted()
isCommitted
in interface javax.servlet.ServletResponse
public boolean isError()
public boolean isRedirect()
public void reset()
reset
in interface javax.servlet.ServletResponse
public void resetBuffer()
resetBuffer
in interface javax.servlet.ServletResponse
public void sendError(int code) throws java.io.IOException
sendError
in interface javax.servlet.http.HttpServletResponse
code
- The code
java.io.IOException
- Not usedpublic void sendError(int code, java.lang.String msg) throws java.io.IOException
sendError
in interface javax.servlet.http.HttpServletResponse
code
- The error codemsg
- The error message
java.io.IOException
- Not usedpublic void sendRedirect(java.lang.String location) throws java.io.IOException
sendRedirect
in interface javax.servlet.http.HttpServletResponse
location
- The location to redirectLocation to
java.io.IOException
- Not usedpublic void setBufferSize(int size)
setBufferSize
in interface javax.servlet.ServletResponse
size
- The sizepublic void setCharacterEncoding(java.lang.String characterEncoding)
characterEncoding
- The character encodingpublic void setContentLength(int length)
setContentLength
in interface javax.servlet.ServletResponse
length
- The lengthpublic void setContentType(java.lang.String type)
setContentType
in interface javax.servlet.ServletResponse
type
- The content typepublic void setDateHeader(java.lang.String name, long l)
setDateHeader
in interface javax.servlet.http.HttpServletResponse
name
- The header namel
- The long valuepublic void setHeader(java.lang.String name, java.lang.String value)
setHeader
in interface javax.servlet.http.HttpServletResponse
name
- The name for the headervalue
- The value for the headerpublic void setIntHeader(java.lang.String name, int i)
setIntHeader
in interface javax.servlet.http.HttpServletResponse
name
- The header namei
- The valuepublic void setLocale(java.util.Locale locale)
setLocale
in interface javax.servlet.ServletResponse
locale
- The localepublic void setStatus(int status)
setStatus
in interface javax.servlet.http.HttpServletResponse
status
- The statuspublic void setStatus(int status, java.lang.String msg)
setStatus
in interface javax.servlet.http.HttpServletResponse
status
- The statusmsg
- The message
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |