wicket.protocol.http
Class WebResponse

java.lang.Object
  extended bywicket.Response
      extended bywicket.protocol.http.WebResponse
Direct Known Subclasses:
BufferedWebResponse, WebResponseWithCryptedUrl

public class WebResponse
extends Response

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.

Author:
Jonathan Locke

Field Summary
protected  boolean redirect
          True if response is a redirect.
 
Method Summary
 void close()
          Closes response output.
 java.lang.String encodeURL(java.lang.String url)
          Returns the given url encoded.
 javax.servlet.http.HttpServletResponse getHttpServletResponse()
          Gets the wrapped http servlet response object.
 java.io.OutputStream getOutputStream()
           
 boolean isRedirect()
          Whether this response is going to redirect the user agent.
 void redirect(java.lang.String url)
          Redirects to the given 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.
 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(java.lang.String string)
          Writes string to response output.
 
Methods inherited from class wicket.Response
write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

redirect

protected boolean redirect
True if response is a redirect.

Method Detail

close

public void close()
Closes response output.

Overrides:
close in class Response

encodeURL

public java.lang.String encodeURL(java.lang.String url)
Returns the given url encoded.

Overrides:
encodeURL in class Response
Parameters:
url - The URL to encode
Returns:
The encoded url

getHttpServletResponse

public final javax.servlet.http.HttpServletResponse getHttpServletResponse()
Gets the wrapped http servlet response object.

Returns:
The wrapped http servlet response object

getOutputStream

public java.io.OutputStream getOutputStream()
Specified by:
getOutputStream in class Response
Returns:
The output stream for this response
See Also:
Response.getOutputStream()

isRedirect

public final boolean isRedirect()
Whether this response is going to redirect the user agent.

Overrides:
isRedirect in class Response
Returns:
True if this response is going to redirect the user agent

redirect

public void redirect(java.lang.String url)
Redirects to the given url.

Overrides:
redirect in class Response
Parameters:
url - The URL to redirect to

setContentType

public final void setContentType(java.lang.String mimeType)
Set the content type on the response.

Overrides:
setContentType in class Response
Parameters:
mimeType - The mime type

setContentLength

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

Overrides:
setContentLength in class Response
Parameters:
length - The length of the content
See Also:
Response.setContentLength(long)

setLastModifiedTime

public void setLastModifiedTime(Time time)
Description copied from class: Response
Set the contents last modified time, if appropriate in the subclass. This default implementation does nothing.

Overrides:
setLastModifiedTime in class Response
Parameters:
time - The time object
See Also:
Response.setLastModifiedTime(wicket.util.time.Time)

setLocale

public final void setLocale(java.util.Locale locale)
Output stream encoding. If the deployment descriptor contains a locale-encoding-mapping-list element, and that element provides a mapping for the given locale, that mapping is used. Otherwise, the mapping from locale to character encoding is container dependent. Default is ISO-8859-1.

Overrides:
setLocale in class Response
Parameters:
locale - The locale use for mapping the character encoding
See Also:
ServletResponse.setLocale(java.util.Locale)

write

public void write(java.lang.String string)
Writes string to response output.

Specified by:
write in class Response
Parameters:
string - The string to write


Copyright © 2004-2005 Wicket developers. All Rights Reserved.