From: Leif Åstrand Date: Wed, 4 Jan 2012 07:05:12 +0000 (+0200) Subject: #8172 WrappedResponse is missing javadoc X-Git-Tag: 7.0.0.alpha2~541^2~12 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=25a31ddd990d11501fbdf290308829dbc6a705c7;p=vaadin-framework.git #8172 WrappedResponse is missing javadoc --- 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 OutputStream for writing binary data in the + * response. + *

+ * Either this method or getWriter() may be called to write the response, + * not both. + * + * @return a OutputStream 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 PrintWriter object that can send character text to + * the client. The PrintWriter uses the character encoding defined using + * setContentType. + *

+ * Either this method or getOutputStream() may be called to write the + * response, not both. + * + * @return a PrintWriter 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(); }