portletspec3
  1. portletspec3
  2. PORTLETSPEC3-35

Errata: apidoc description of MimeResponse.setContentType() needs to specify exception

    Details

      Description

      The portlet specification in section 12.5.1 Content Type states:

      For the render response the setContentType method must throw an IllegalArgumentException if the content type set does not match (including wildcard matching) any of the content types returned by the getResponseContentType method of the PortletRequest objectcxii.

      However, this is not reflected in the apidocs for the method.

      void setContentType(String type)

      Sets the MIME type for the response. The portlet should set the content type before calling getWriter() or getPortletOutputStream(). If the content type is not the PortletRequest.getResponseContentType() value is set as response content type by the portlet container.

      Calling setContentType after getWriter or getOutputStream does not change the content type.

      Parameters:
      type - the content MIME type
      See Also:
      PortletRequest.getResponseContentTypes(), getContentType()

      We need to add a "Throws" section to the description. I would also use the opportunity to fix the description ... seems to be worded strangely. I believe the following captures the intention:

      void setContentType(String type)

      Sets the MIME type for the response. The portlet should set the content type before calling getWriter() or getPortletOutputStream(). If the content type is not set using this method, the preferred content type as returned by PortletRequest.getResponseContentType() is used.

      Calling setContentType after getWriter or getOutputStream does not change the content type.

      Parameters:
      type - the content MIME type
      See Also:
      PortletRequest.getResponseContentTypes(), getContentType()
      Throws:
      IllegalArgumentException - if the content type is invalid.

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            msnicklous
            Reporter:
            msnicklous
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: