org.apache.tapestry.web
Interface WebResponse

All Known Implementing Classes:
ServletWebResponse

public interface WebResponse

Controls the response to the client, and specifically allows for creating the output stream (or print writer) to which content is sent.

Since:
4.0
Author:
Howard M. Lewis Ship

Method Summary
 java.lang.String encodeURL(java.lang.String url)
          Encodes a URL, which adds information to the URL needed to ensure that the request triggered by the URL will be associated with the current session (if any).
 java.lang.String getNamespace()
          Returns a value to be prefixed or suffixed with any client-side JavaScript elements (variables and function names) to ensure that they are unique with the context of the entire page.
 java.io.OutputStream getOutputStream(ContentType contentType)
          Returns a output stream to which output should be sent.
 java.io.PrintWriter getPrintWriter(ContentType contentType)
          Returns a PrintWriterto which output should be sent.
 void reset()
          Resets any buffered content.
 void setContentLength(int contentLength)
           
 void setDateHeader(java.lang.String string, long date)
          Sets a response header as a date.
 void setStatus(int status)
          Sets the status code for this response.
 

Method Detail

getOutputStream

java.io.OutputStream getOutputStream(ContentType contentType)
                                     throws java.io.IOException
Returns a output stream to which output should be sent. This method should only be invoked once on a response.

Returns:
the output stream, configured for the given type.
Throws:
java.io.IOException

getPrintWriter

java.io.PrintWriter getPrintWriter(ContentType contentType)
                                   throws java.io.IOException
Returns a PrintWriterto which output should be sent. This method should be invoked once on a response. A second call is expected to be so that an exception page can be rendered, and the underlying request data is reset.

Throws:
java.io.IOException

encodeURL

java.lang.String encodeURL(java.lang.String url)
Encodes a URL, which adds information to the URL needed to ensure that the request triggered by the URL will be associated with the current session (if any). In most cases, the string is returned unchanged.


reset

void reset()
Resets any buffered content. This may be used after an error to radically change what the output will be.


setContentLength

void setContentLength(int contentLength)

getNamespace

java.lang.String getNamespace()
Returns a value to be prefixed or suffixed with any client-side JavaScript elements (variables and function names) to ensure that they are unique with the context of the entire page. For servlets, this is the empty string.


setDateHeader

void setDateHeader(java.lang.String string,
                   long date)
Sets a response header as a date.

Parameters:
string - the name of the header to set.
date - the date value to set, in milliseconds since the epoch.

setStatus

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