[PORTLETSPEC3-35] Errata: apidoc description of MimeResponse.setContentType() needs to specify exception Created: 21/Aug/13  Updated: 22/Aug/13  Resolved: 22/Aug/13

Status: Resolved
Project: portletspec3
Component/s: JSR 286 Portlet Specification Errata
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Minor
Reporter: msnicklous Assignee: msnicklous
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 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.



 Comments   
Comment by msnicklous [ 22/Aug/13 ]

Updated description to MimeResponse.setContentType to add exception that is thrown when the content type is invalid and to clarify the description of that method.

Generated at Wed Jun 03 16:30:36 UTC 2015 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.