|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.wicket.Response
org.apache.wicket.protocol.http.WebResponse
public class WebResponse
Implements responses over the HTTP protocol by holding an underlying HttpServletResponse object and providing convenience methods for using that object. Convenience methods include methods which: add a cookie, close the stream, encode a URL, redirect a request to another resource, determine if a redirect has been issued, set the content type, set the locale and, most importantly, write a String to the response output.
| Field Summary | |
|---|---|
protected boolean |
redirect
True if response is a redirect. |
| Constructor Summary | |
|---|---|
WebResponse()
Constructor for testing harness. |
|
WebResponse(javax.servlet.http.HttpServletResponse httpServletResponse)
Package private constructor. |
|
| Method Summary | |
|---|---|
void |
addCookie(javax.servlet.http.Cookie cookie)
Add a cookie to the web response |
void |
clearCookie(javax.servlet.http.Cookie cookie)
Convenience method for clearing a cookie. |
void |
close()
Closes response output. |
java.lang.CharSequence |
encodeURL(java.lang.CharSequence url)
Returns the given url encoded. |
javax.servlet.http.HttpServletResponse |
getHttpServletResponse()
Gets the wrapped http servlet response object. |
java.io.OutputStream |
getOutputStream()
|
boolean |
isAjax()
Is the request, which matches this response an ajax request. |
boolean |
isRedirect()
Whether this response is going to redirect the user agent. |
void |
redirect(java.lang.String url)
CLIENTS SHOULD NEVER CALL THIS METHOD FOR DAY TO DAY USE! |
void |
setAjax(boolean ajax)
Set that the request which matches this response is an ajax request. |
void |
setAttachmentHeader(java.lang.String filename)
Convenience method for setting the content-disposition:attachment header. |
void |
setContentLength(long length)
Set the content length on the response, if appropriate in the subclass. |
void |
setContentType(java.lang.String mimeType)
Set the content type on the response. |
void |
setDateHeader(java.lang.String header,
long date)
Set a header to the date value in the servlet response stream. |
void |
setHeader(java.lang.String header,
java.lang.String value)
Set a header to the string value in the servlet response stream. |
void |
setLastModifiedTime(Time time)
Set the contents last modified time, if appropriate in the subclass. |
void |
setLocale(java.util.Locale locale)
Output stream encoding. |
void |
write(AppendingStringBuffer asb)
Writes AppendingStringBuffer to response output. |
void |
write(java.lang.CharSequence string)
Writes string to response output. |
| Methods inherited from class org.apache.wicket.Response |
|---|
detectContentType, filter, getCharacterEncoding, println, reset, setCharacterEncoding, write, write |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected boolean redirect
| Constructor Detail |
|---|
public WebResponse()
public WebResponse(javax.servlet.http.HttpServletResponse httpServletResponse)
httpServletResponse - The servlet response object| Method Detail |
|---|
public void addCookie(javax.servlet.http.Cookie cookie)
cookie - public void clearCookie(javax.servlet.http.Cookie cookie)
cookie - The cookie to setaddCookie(Cookie)public void close()
close in class Responsepublic java.lang.CharSequence encodeURL(java.lang.CharSequence url)
encodeURL in class Responseurl - The URL to encode
public final javax.servlet.http.HttpServletResponse getHttpServletResponse()
public java.io.OutputStream getOutputStream()
getOutputStream in class ResponseResponse.getOutputStream()public final boolean isRedirect()
isRedirect in class Responsepublic void redirect(java.lang.String url)
Redirects to the given url. Implementations should encode the URL to make sure cookie-less operation is supported in case clients forgot.
redirect in class Responseurl - The URL to redirect topublic final void setContentType(java.lang.String mimeType)
setContentType in class ResponsemimeType - The mime typepublic void setContentLength(long length)
Response
setContentLength in class Responselength - The length of the contentResponse.setContentLength(long)public void setLastModifiedTime(Time time)
Response
setLastModifiedTime in class Responsetime - The time objectResponse.setLastModifiedTime(org.apache.wicket.util.time.Time)public final void setLocale(java.util.Locale locale)
setLocale in class Responselocale - The locale use for mapping the character encodingServletResponse.setLocale(java.util.Locale)public void write(java.lang.CharSequence string)
write in class Responsestring - The string to writepublic void write(AppendingStringBuffer asb)
asb - The AppendingStringBuffer to write to the stream
public void setDateHeader(java.lang.String header,
long date)
header - date -
public void setHeader(java.lang.String header,
java.lang.String value)
header - value - public void setAttachmentHeader(java.lang.String filename)
filename - file name of the attachmentpublic boolean isAjax()
public void setAjax(boolean ajax)
ajax - True if the request is an ajax request.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||