diff options
author | Leif Åstrand <leif@vaadin.com> | 2012-01-04 09:05:12 +0200 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2012-01-04 09:05:12 +0200 |
commit | 25a31ddd990d11501fbdf290308829dbc6a705c7 (patch) | |
tree | ba750f7db09dc6a29537df492e7513734d96e5d9 | |
parent | 634db57f243e9107bca3362ffd21eaa9d0d7f7b7 (diff) | |
download | vaadin-framework-25a31ddd990d11501fbdf290308829dbc6a705c7.tar.gz vaadin-framework-25a31ddd990d11501fbdf290308829dbc6a705c7.zip |
#8172 WrappedResponse is missing javadoc
-rw-r--r-- | src/com/vaadin/terminal/WrappedResponse.java | 113 |
1 files changed, 111 insertions, 2 deletions
diff --git a/src/com/vaadin/terminal/WrappedResponse.java b/src/com/vaadin/terminal/WrappedResponse.java index bbcc1ff003..995133a269 100644 --- a/src/com/vaadin/terminal/WrappedResponse.java +++ b/src/com/vaadin/terminal/WrappedResponse.java @@ -9,30 +9,139 @@ import java.io.OutputStream; import java.io.PrintWriter; import java.io.Serializable; +import javax.portlet.MimeResponse; +import javax.portlet.PortletResponse; +import javax.portlet.ResourceResponse; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletResponse; + +/** + * A generic response from the server, wrapping a more specific response type, + * e.g. HttpServletResponse or PortletResponse. + * + * @since 7.0 + */ public interface WrappedResponse extends Serializable { + /** + * Sets the (http) status code for the response. If you want to include an + * error message along the status code, use {@link #sendError(int, String)} + * instead. + * + * @param statusCode + * the status code to set + * @see HttpServletResponse#setStatus(int) + * + * @see ResourceResponse#HTTP_STATUS_CODE + */ public void setStatus(int statusCode); + /** + * Sets the content type of this response. If the content type including a + * charset is set before {@link #getWriter()} is invoked, the returned + * PrintWriter will automatically use the defined charset. + * + * @param contentType + * a string specifying the MIME type of the content + * + * @see ServletResponse#setContentType(String) + * @see MimeResponse#setContentType(String) + */ public void setContentType(String contentType); + /** + * Sets the value of a generic response header. If the header had already + * been set, the new value overwrites the previous one. + * + * @param name + * the name of the header + * @param value + * the header value. + * + * @see HttpServletResponse#setHeader(String, String) + * @see PortletResponse#setProperty(String, String) + */ public void setHeader(String name, String value); + /** + * Properly formats a timestamp as a date header. If the header had already + * been set, the new value overwrites the previous one. + * + * @param name + * the name of the header + * @param timestamp + * the number of milliseconds since epoch + * + * @see HttpServletResponse#setDateHeader(String, long) + */ public void setDateHeader(String name, long timestamp); + /** + * Returns a <code>OutputStream</code> for writing binary data in the + * response. + * <p> + * Either this method or getWriter() may be called to write the response, + * not both. + * + * @return a <code>OutputStream</code> for writing binary data + * @throws IOException + * if an input or output exception occurred + * + * @see #getWriter() + * @see ServletResponse#getOutputStream() + * @see MimeResponse#getPortletOutputStream() + */ public OutputStream getOutputStream() throws IOException; + /** + * Returns a <code>PrintWriter</code> object that can send character text to + * the client. The PrintWriter uses the character encoding defined using + * setContentType. + * <p> + * Either this method or getOutputStream() may be called to write the + * response, not both. + * + * @return a <code>PrintWriter</code> for writing character text + * @throws IOException + * if an input or output exception occurred + * + * @see #getOutputStream() + * @see ServletResponse#getWriter() + * @see MimeResponse#getWriter() + */ public PrintWriter getWriter() throws IOException; /** - * Sets time in milliseconds, -1 means no cache at all. All required headers - * related to caching in the response are set based on the time. + * Sets cache time in milliseconds, -1 means no cache at all. All required + * headers related to caching in the response are set based on the time. * * @param milliseconds * Cache time in milliseconds */ public void setCacheTime(long milliseconds); + /** + * Sends an error response to the client using the specified status code and + * clears the buffer. In some configurations, this can cause a predefined + * error page to be displayed. + * + * @param errorCode + * the HTTP status code + * @param message + * a message to accompany the error + * @throws IOException + * if an input or output exception occurs + * + * @see HttpServletResponse#sendError(int, String) + */ public void sendError(int errorCode, String message) throws IOException; + /** + * Gets the deployment configuration for the context of this response. + * + * @return the deployment configuration + * + * @see DeploymentConfiguration + */ public DeploymentConfiguration getDeploymentConfiguration(); } |