org.apache.wicket.request.http
Class WebResponse

java.lang.Object
  extended by org.apache.wicket.request.Response
      extended by org.apache.wicket.request.http.WebResponse
Direct Known Subclasses:
BufferedWebResponse, MockWebResponse, ServletWebResponse

public abstract class WebResponse
extends Response

Base class for web-related responses.

Author:
Matej Knopp

Constructor Summary
WebResponse()
           
 
Method Summary
abstract  void addCookie(javax.servlet.http.Cookie cookie)
          Add a cookie to the web response
abstract  void clearCookie(javax.servlet.http.Cookie cookie)
          Convenience method for clearing a cookie.
abstract  void flush()
          Flushes the response.
abstract  boolean isRedirect()
           
abstract  void sendError(int sc, java.lang.String msg)
          Send error status code with optional message.
abstract  void sendRedirect(java.lang.String url)
          Redirects the response to specified URL.
 void setAttachmentHeader(java.lang.String filename)
          Convenience method for setting the content-disposition:attachment header.
abstract  void setContentLength(long length)
          Set the content length on the response, if appropriate in the subclass.
abstract  void setContentType(java.lang.String mimeType)
          Set the content type on the response, if appropriate in the subclass.
abstract  void setDateHeader(java.lang.String name, long date)
          Set a header to the date value in the servlet response stream.
abstract  void setHeader(java.lang.String name, java.lang.String value)
          Set a header to the string value in the servlet response stream.
 void setInlineHeader(java.lang.String filename)
          Convenience method for setting the content-disposition:inline header.
 void setLastModifiedTime(long time)
          Set the contents last modified time, if appropriate in the subclass.
abstract  void setStatus(int sc)
          Sets the status code for this response.
 
Methods inherited from class org.apache.wicket.request.Response
close, encodeURL, reset, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebResponse

public WebResponse()
Method Detail

addCookie

public abstract void addCookie(javax.servlet.http.Cookie cookie)
Add a cookie to the web response

Parameters:
cookie -

clearCookie

public abstract void clearCookie(javax.servlet.http.Cookie cookie)
Convenience method for clearing a cookie.

Parameters:
cookie - The cookie to set
See Also:
addCookie(Cookie)

setHeader

public abstract void setHeader(java.lang.String name,
                               java.lang.String value)
Set a header to the string value in the servlet response stream.

Parameters:
name -
value -

setDateHeader

public abstract void setDateHeader(java.lang.String name,
                                   long date)
Set a header to the date value in the servlet response stream.

Parameters:
name -
date -

setContentLength

public abstract void setContentLength(long length)
Set the content length on the response, if appropriate in the subclass. This default implementation does nothing.

Parameters:
length - The length of the content

setContentType

public abstract void setContentType(java.lang.String mimeType)
Set the content type on the response, if appropriate in the subclass. This default implementation does nothing.

Parameters:
mimeType - The mime type

setLastModifiedTime

public void setLastModifiedTime(long time)
Set the contents last modified time, if appropriate in the subclass.

Parameters:
time - The last modified time in milliseconds

setAttachmentHeader

public void setAttachmentHeader(java.lang.String filename)
Convenience method for setting the content-disposition:attachment header. This header is used if the response should prompt the user to download it as a file instead of opening in a browser.

Parameters:
filename - file name of the attachment

setInlineHeader

public void setInlineHeader(java.lang.String filename)
Convenience method for setting the content-disposition:inline header. This header is used if the response should be shown embedded in browser window while having custom file name when user saves the response. browser.

Parameters:
filename - file name of the attachment

setStatus

public abstract void setStatus(int sc)
Sets the status code for this response.

Parameters:
sc - status code

sendError

public abstract void sendError(int sc,
                               java.lang.String msg)
Send error status code with optional message.

Parameters:
sc -
msg -
Throws:
java.io.IOException

sendRedirect

public abstract void sendRedirect(java.lang.String url)
Redirects the response to specified URL. The implementation is responsible for properly encoding the URL.

Parameters:
url -

isRedirect

public abstract boolean isRedirect()
Returns:
true is sendRedirect(String) was called, false otherwise.

flush

public abstract void flush()
Flushes the response.



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