org.apache.wicket.protocol.http.servlet
Class ServletWebResponse

java.lang.Object
  extended by org.apache.wicket.request.Response
      extended by org.apache.wicket.request.http.WebResponse
          extended by org.apache.wicket.protocol.http.servlet.ServletWebResponse

public class ServletWebResponse
extends WebResponse

WebResponse that wraps a ServletWebResponse.

Author:
Matej Knopp

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.wicket.request.http.WebResponse
WebResponse.CacheScope
 
Field Summary
 
Fields inherited from class org.apache.wicket.request.http.WebResponse
MAX_CACHE_DURATION
 
Constructor Summary
ServletWebResponse(ServletWebRequest webRequest, javax.servlet.http.HttpServletResponse httpServletResponse)
          Construct.
 
Method Summary
 void addCookie(javax.servlet.http.Cookie cookie)
          Add a cookie to the web response
 void addHeader(java.lang.String name, java.lang.String value)
          Add a value to the servlet response stream.
 void clearCookie(javax.servlet.http.Cookie cookie)
          Convenience method for clearing a cookie.
 java.lang.String encodeRedirectURL(java.lang.CharSequence url)
          Encodes urls used to redirect.
 java.lang.String encodeURL(java.lang.CharSequence url)
          Encodes the specified URL by including the session ID in it, or, if encoding is not needed, returns the URL unchanged.
 void flush()
          Flushes the response.
 javax.servlet.http.HttpServletResponse getContainerResponse()
          Provides access to the low-level container response object that implementaion of this Response delegate to.
 boolean isRedirect()
           
 void reset()
          Called when the Response needs to reset itself.
 void sendError(int sc, java.lang.String msg)
          Send error status code with optional message.
 void sendRedirect(java.lang.String url)
          Redirects the response to specified URL.
 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, if appropriate in the subclass.
 void setDateHeader(java.lang.String name, Time date)
          Set a header to the date value in the servlet response stream.
 void setHeader(java.lang.String name, java.lang.String value)
          Set a header to the string value in the servlet response stream.
 void setStatus(int sc)
          Sets the status code for this response.
 void write(byte[] array)
          Writes the buffer to output.
 void write(java.lang.CharSequence sequence)
          Writes the CharSequence to output.
 
Methods inherited from class org.apache.wicket.request.http.WebResponse
disableCaching, enableCaching, setAttachmentHeader, setInlineHeader, setLastModifiedTime
 
Methods inherited from class org.apache.wicket.request.Response
close
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServletWebResponse

public ServletWebResponse(ServletWebRequest webRequest,
                          javax.servlet.http.HttpServletResponse httpServletResponse)
Construct.

Parameters:
webRequest -
httpServletResponse -
Method Detail

addCookie

public void addCookie(javax.servlet.http.Cookie cookie)
Description copied from class: WebResponse
Add a cookie to the web response

Specified by:
addCookie in class WebResponse

clearCookie

public void clearCookie(javax.servlet.http.Cookie cookie)
Description copied from class: WebResponse
Convenience method for clearing a cookie.

Specified by:
clearCookie in class WebResponse
Parameters:
cookie - The cookie to set
See Also:
WebResponse.addCookie(Cookie)

setContentLength

public void setContentLength(long length)
Description copied from class: WebResponse
Set the content length on the response, if appropriate in the subclass. This default implementation does nothing.

Specified by:
setContentLength in class WebResponse
Parameters:
length - The length of the content

setContentType

public void setContentType(java.lang.String mimeType)
Description copied from class: WebResponse
Set the content type on the response, if appropriate in the subclass. This default implementation does nothing.

Specified by:
setContentType in class WebResponse
Parameters:
mimeType - The mime type

setDateHeader

public void setDateHeader(java.lang.String name,
                          Time date)
Description copied from class: WebResponse
Set a header to the date value in the servlet response stream.

Specified by:
setDateHeader in class WebResponse

setHeader

public void setHeader(java.lang.String name,
                      java.lang.String value)
Description copied from class: WebResponse
Set a header to the string value in the servlet response stream.

Specified by:
setHeader in class WebResponse

addHeader

public void addHeader(java.lang.String name,
                      java.lang.String value)
Description copied from class: WebResponse
Add a value to the servlet response stream.

Specified by:
addHeader in class WebResponse

write

public void write(java.lang.CharSequence sequence)
Description copied from class: Response
Writes the CharSequence to output.

Specified by:
write in class Response

write

public void write(byte[] array)
Description copied from class: Response
Writes the buffer to output.

Specified by:
write in class Response

setStatus

public void setStatus(int sc)
Description copied from class: WebResponse
Sets the status code for this response.

Specified by:
setStatus in class WebResponse
Parameters:
sc - status code

sendError

public void sendError(int sc,
                      java.lang.String msg)
Description copied from class: WebResponse
Send error status code with optional message.

Specified by:
sendError in class WebResponse

encodeURL

public java.lang.String encodeURL(java.lang.CharSequence url)
Description copied from class: Response
Encodes the specified URL by including the session ID in it, or, if encoding is not needed, returns the URL unchanged.

Specified by:
encodeURL in class Response
Returns:
encoded URL

encodeRedirectURL

public java.lang.String encodeRedirectURL(java.lang.CharSequence url)
Description copied from class: WebResponse
Encodes urls used to redirect. Sometimes rules for encoding URLs for redirecting differ from encoding URLs for links, so this method is broken out away form Response.encodeURL(CharSequence).

Specified by:
encodeRedirectURL in class WebResponse
Returns:
encoded URL

sendRedirect

public void sendRedirect(java.lang.String url)
Description copied from class: WebResponse
Redirects the response to specified URL. The implementation is responsible for properly encoding the URL. Implementations of this method should run passed in url parameters throu the #encodeRedirectURL(String) method.

Specified by:
sendRedirect in class WebResponse

isRedirect

public boolean isRedirect()
Specified by:
isRedirect in class WebResponse
Returns:
true is WebResponse.sendRedirect(String) was called, false otherwise.

flush

public void flush()
Description copied from class: WebResponse
Flushes the response.

Specified by:
flush in class WebResponse

reset

public void reset()
Description copied from class: Response
Called when the Response needs to reset itself. Subclasses can empty there buffer or build up state.

Overrides:
reset in class Response

getContainerResponse

public javax.servlet.http.HttpServletResponse getContainerResponse()
Description copied from class: Response
Provides access to the low-level container response object that implementaion of this Response delegate to. This allows users to access features provided by the container response but not by generalized Wicket Response objects.

Specified by:
getContainerResponse in class Response
Returns:
low-level container response object, or null if none


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.