Class ResourceResponseWrapper

    • Constructor Detail

      • ResourceResponseWrapper

        public ResourceResponseWrapper​(ResourceResponse response)
        Creates an ResourceResponse adaptor wrapping the given response object.
        Parameters:
        response - the event response to wrap
        Throws:
        IllegalArgumentException - if the response is null
    • Method Detail

      • setResponse

        public void setResponse​(ResourceResponse response)
        Sets the response object being wrapped.
        Parameters:
        response - the response to set
        Throws:
        IllegalArgumentException - if the response is null.
      • setCharacterEncoding

        public void setCharacterEncoding​(String charset)
        Description copied from interface: ResourceResponse
        Sets the character encoding (MIME charset) of the response being sent to the client, for example, to UTF-8. If the character encoding has already been set by either the portlet container, setContentType(java.lang.String) or setLocale(java.util.Locale), this method overrides it. Calling setContentType(java.lang.String) with the String of text/html and calling this method with the String of UTF-8 is equivalent with calling setContentType with the String of text/html; charset=UTF-8.

        This method can be called repeatedly to change the character encoding. This method has no effect if it is called after getWriter has been called or after the response has been committed.

        Specified by:
        setCharacterEncoding in interface ResourceResponse
        Parameters:
        charset - a String specifying only the character set defined by IANA Character Sets (http://www.iana.org/assignments/character-sets)
      • setLocale

        public void setLocale​(Locale loc)
        Description copied from interface: ResourceResponse
        Sets the locale of the response, setting the headers (including the Content-Type's charset) as appropriate. This method should be called before a call to getWriter(). By default, the response locale is the default locale provided by the portlet container.

        This method has no effect if it is called after the response has been committed.

        Specified by:
        setLocale in interface ResourceResponse
        Parameters:
        loc - the new locale of the response
      • setContentLength

        public void setContentLength​(int len)
        Description copied from interface: ResourceResponse
        Sets the length of the content body in the response.

        This method has no effect if it is called after the response has been committed.

        Specified by:
        setContentLength in interface ResourceResponse
        Parameters:
        len - an integer specifying the length of the content being returned; sets the Content-Length header
      • setStatus

        public void setStatus​(int sc)
        Description copied from interface: ResourceResponse
        Sets the HTTP status code for this request.

        The status code should be a valid value as defined in IETF rfc2616 "Hypertext Transfer Protocol -- HTTP/1.1" . The status code constants "SC_*" defined in HttpServletResponse may be used.

        This method has no effect if it is called after the response has been committed.

        Specified by:
        setStatus in interface ResourceResponse
        Parameters:
        sc - an integer specifying the status code for this request
        See Also:
        HttpServletResponse, HttpServletResponse.setStatus(int)
      • getStatus

        public int getStatus()
        Description copied from interface: ResourceResponse
        Gets the current HTTP status code for the response.
        Specified by:
        getStatus in interface ResourceResponse
        Returns:
        The HTTP status code
        See Also:
        HttpServletResponse, HttpServletResponse.getStatus()
      • setContentLengthLong

        public void setContentLengthLong​(long len)
        Description copied from interface: ResourceResponse
        Sets the length of the content body in the response.

        This method has no effect if it is called after the response has been committed.

        Specified by:
        setContentLengthLong in interface ResourceResponse
        Parameters:
        len - a long specifying the length of the content being returned; sets the Content-Length header