org.apache.wicket.protocol.http
Class BufferedWebResponse

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.BufferedWebResponse

public class BufferedWebResponse
extends WebResponse

Subclass of WebResponse that buffers the actions and performs those on another response.

Author:
Matej Knopp
See Also:
writeTo(WebResponse)

Constructor Summary
BufferedWebResponse(WebResponse originalResponse)
          Construct.
 
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.
 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.
 java.lang.CharSequence getText()
          Returns the text already written to this response.
 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, long 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 setText(java.lang.CharSequence text)
          Replaces the text in this response
 java.lang.String toString()
           
 void write(byte[] array)
          Writes the buffer to output.
 void write(java.lang.CharSequence sequence)
          Writes the CharSequence to output.
 void writeTo(WebResponse response)
          Writes the content of the buffer to the specified response.
 
Methods inherited from class org.apache.wicket.request.http.WebResponse
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, wait, wait, wait
 

Constructor Detail

BufferedWebResponse

public BufferedWebResponse(WebResponse originalResponse)
Construct.

Parameters:
originalResponse -
Method Detail

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

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

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,
                          long 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

write

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

Specified by:
write in class Response

getText

public java.lang.CharSequence getText()
Returns the text already written to this response.

Returns:
text

setText

public void setText(java.lang.CharSequence text)
Replaces the text in this response

Parameters:
text -

write

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

Specified by:
write in class Response

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.

Specified by:
sendRedirect in class WebResponse

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

writeTo

public void writeTo(WebResponse response)
Writes the content of the buffer to the specified response. Also sets the properties and and headers.

Parameters:
response -

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

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()


Copyright © 2004-2010 Apache Software Foundation. All Rights Reserved.