wicket
Class Response

java.lang.Object
  extended by wicket.Response
Direct Known Subclasses:
ConsoleResponse, FileResponse, NullResponse, StringResponse, WebResponse, WicketPortletResponse

public abstract class Response
extends java.lang.Object

Abstract base class for different implementations of response writing. A subclass must implement write(String) to write a String to the response destination (whether it be a browser, a file, a test harness or some other place). A subclass may optionally implement close(), encodeURL(String), redirect(String), isRedirect() or setContentType(String) as appropriate.

Author:
Jonathan Locke

Constructor Summary
Response()
           
 
Method Summary
 void close()
          Closes the response output stream
 java.lang.CharSequence encodeURL(java.lang.CharSequence url)
          An implementation of this method is only required if a subclass wishes to support sessions via URL rewriting.
 AppendingStringBuffer filter(AppendingStringBuffer responseBuffer)
          THIS METHOD IS NOT PART OF THE WICKET PUBLIC API.
 java.lang.String getCharacterEncoding()
          Get the default encoding
abstract  java.io.OutputStream getOutputStream()
           
 boolean isRedirect()
          Returns true if a redirection has occurred.
 void println(java.lang.CharSequence string)
          Writes the given string to the Response subclass output destination and appends a cr/nl depending on the OS
 void redirect(java.lang.String url)
          CLIENTS SHOULD NEVER CALL THIS METHOD FOR DAY TO DAY USE!
 void reset()
          Called when the Response needs to reset itself.
 void setCharacterEncoding(java.lang.String encoding)
          Set the default encoding for the output.
 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 setLastModifiedTime(Time time)
          Set the contents last modified time, if appropriate in the subclass.
 void setLocale(java.util.Locale locale)
           
abstract  void write(java.lang.CharSequence string)
          Writes the given string to the Response subclass output destination.
 void write(ComponentTag tag)
          Writes the given tag to via the write(String) abstract method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Response

public Response()
Method Detail

close

public void close()
Closes the response output stream


reset

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


encodeURL

public java.lang.CharSequence encodeURL(java.lang.CharSequence url)
An implementation of this method is only required if a subclass wishes to support sessions via URL rewriting. This default implementation simply returns the URL String it is passed.

Parameters:
url - The URL to encode
Returns:
The encoded url

filter

public final AppendingStringBuffer filter(AppendingStringBuffer responseBuffer)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT USE IT. Loops over all the response filters that were set (if any) with the give response returns the response buffer itself if there where now filters or the response buffer that was created/returned by the filter(s)

Parameters:
responseBuffer - The response buffer to be filtered
Returns:
Returns the filtered string buffer.

getCharacterEncoding

public java.lang.String getCharacterEncoding()
Get the default encoding

Returns:
default encoding

getOutputStream

public abstract java.io.OutputStream getOutputStream()
Returns:
The output stream for this response

isRedirect

public boolean isRedirect()
Returns true if a redirection has occurred. The default implementation always returns false since redirect is not implemented by default.

Returns:
True if the redirect method has been called, making this response a redirect.

redirect

public void redirect(java.lang.String url)
CLIENTS SHOULD NEVER CALL THIS METHOD FOR DAY TO DAY USE!

A subclass may override this method to implement redirection. Subclasses which have no need to do redirection may choose not to override this default implementation, which does nothing. For example, if a subclass wishes to write output to a file or is part of a testing harness, there may be no meaning to redirection.

Parameters:
url - The URL to redirect to

setCharacterEncoding

public void setCharacterEncoding(java.lang.String encoding)
Set the default encoding for the output. Note: It is up to the derived class to make use of the information. Class Respsonse simply stores the value, but does not apply it anywhere automatically.

Parameters:
encoding -

setContentLength

public 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 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(Time time)
Set the contents last modified time, if appropriate in the subclass. This default implementation does nothing.

Parameters:
time - The time object

setLocale

public void setLocale(java.util.Locale locale)
Parameters:
locale - Locale to use for this response

write

public final void write(ComponentTag tag)
Writes the given tag to via the write(String) abstract method.

Parameters:
tag - The tag to write

write

public abstract void write(java.lang.CharSequence string)
Writes the given string to the Response subclass output destination.

Parameters:
string - The string to write

println

public final void println(java.lang.CharSequence string)
Writes the given string to the Response subclass output destination and appends a cr/nl depending on the OS

Parameters:
string -


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