com.vaadin.server.

Class VaadinPortletResponse

    • Constructor Detail

      • VaadinPortletResponse

        public VaadinPortletResponse(PortletResponse response,
                                     VaadinPortletService vaadinService)

        Wraps a portlet response and an associated vaadin service

        Parameters:

        response - the portlet response to wrap

        vaadinService - the associated vaadin service

    • Method Detail

      • getOutputStream

        public OutputStream getOutputStream()
                                     throws IOException

        Description copied from interface: VaadinResponse

        Returns a OutputStream for writing binary data in the response.

        Either this method or getWriter() may be called to write the response, not both.

        Specified by:

        getOutputStream in interface VaadinResponse

        Returns:

        a OutputStream for writing binary data

        Throws:

        IOException - if an input or output exception occurred

        See Also:

        VaadinResponse.getWriter(), ServletResponse.getOutputStream(), MimeResponse#getPortletOutputStream()

      • getPortletResponse

        public PortletResponse getPortletResponse()

        Gets the original, unwrapped portlet response.

        Returns:

        the unwrapped portlet response

      • setContentType

        public void setContentType(String type)

        Description copied from interface: VaadinResponse

        Sets the content type of this response. If the content type including a charset is set before VaadinResponse.getWriter() is invoked, the returned PrintWriter will automatically use the defined charset.

        Specified by:

        setContentType in interface VaadinResponse

        Parameters:

        type - a string specifying the MIME type of the content

        See Also:

        ServletResponse.setContentType(String), MimeResponse#setContentType(String)

      • setContentLength

        public void setContentLength(int len)

        Description copied from interface: VaadinResponse

        Sets the length of the content body in the response In HTTP servlets, this method sets the HTTP Content-Length header. For some portlet responses, this method sets the content-length header, for others this method does nothing.

        Specified by:

        setContentLength in interface VaadinResponse

        Parameters:

        len - an integer specifying the length of the content being returned to the client

      • getWriter

        public PrintWriter getWriter()
                              throws IOException

        Description copied from interface: VaadinResponse

        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.

        Specified by:

        getWriter in interface VaadinResponse

        Returns:

        a PrintWriter for writing character text

        Throws:

        IOException - if an input or output exception occurred

        See Also:

        VaadinResponse.getOutputStream(), ServletResponse.getWriter(), MimeResponse#getWriter()

      • setStatus

        public void setStatus(int responseStatus)

        Description copied from interface: VaadinResponse

        Sets the (http) status code for the response. If you want to include an error message along the status code, use VaadinResponse.sendError(int, String) instead.

        Specified by:

        setStatus in interface VaadinResponse

        Parameters:

        responseStatus - the status code to set

        See Also:

        HttpServletResponse.setStatus(int), ResourceResponse#HTTP_STATUS_CODE

      • setHeader

        public void setHeader(String name,
                              String value)

        Description copied from interface: VaadinResponse

        Sets the value of a generic response header. If the header had already been set, the new value overwrites the previous one.

        Specified by:

        setHeader in interface VaadinResponse

        Parameters:

        name - the name of the header

        value - the header value.

        See Also:

        HttpServletResponse.setHeader(String, String), PortletResponse#setProperty(String, String)

      • setDateHeader

        public void setDateHeader(String name,
                                  long timestamp)

        Description copied from interface: VaadinResponse

        Properly formats a timestamp as a date header. If the header had already been set, the new value overwrites the previous one.

        Specified by:

        setDateHeader in interface VaadinResponse

        Parameters:

        name - the name of the header

        timestamp - the number of milliseconds since epoch

        See Also:

        HttpServletResponse.setDateHeader(String, long)

      • setCacheTime

        public void setCacheTime(long milliseconds)

        Description copied from interface: VaadinResponse

        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.

        Specified by:

        setCacheTime in interface VaadinResponse

        Parameters:

        milliseconds - Cache time in milliseconds

      • sendError

        public void sendError(int errorCode,
                              String message)
                       throws IOException

        Description copied from interface: VaadinResponse

        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.

        Specified by:

        sendError in interface VaadinResponse

        Parameters:

        errorCode - the HTTP status code

        message - a message to accompany the error

        Throws:

        IOException - if an input or output exception occurs

        See Also:

        HttpServletResponse.sendError(int, String)

      • addCookie

        public void addCookie(javax.servlet.http.Cookie cookie)

        Description copied from interface: VaadinResponse

        Adds the specified cookie to the response. This method can be called multiple times to set more than one cookie.

        Specified by:

        addCookie in interface VaadinResponse

        Parameters:

        cookie - the Cookie to return to the client

        See Also:

        HttpServletResponse.addCookie(Cookie), PortletResponse#addProperty(Cookie)