[ 
https://issues.apache.org/jira/browse/PLUTO-240?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Scott Nicklous closed PLUTO-240.
--------------------------------
    Resolution: Cannot Reproduce

> Declared charset ignored when setting render response content type
> ------------------------------------------------------------------
>
>                 Key: PLUTO-240
>                 URL: https://issues.apache.org/jira/browse/PLUTO-240
>             Project: Pluto
>          Issue Type: Bug
>    Affects Versions: 1.1.0-beta2
>            Reporter: Tuomas Kiviaho
>            Priority: Minor
>
> Here's a snippet from RenderResponseImpl
>     public void setContentType(String contentType)
>       throws IllegalArgumentException {
>       ArgumentUtility.validateNotNull("contentType", contentType);
>         String mimeType = StringUtils.getMimeTypeWithoutEncoding(contentType);
>         if (!isValidContentType(mimeType)) {
>             throw new IllegalArgumentException("Specified content type '"
>                       + mimeType + "' is not supported.");
>         }
>         getHttpServletResponse().setContentType(mimeType);
>         this.currentContentType = mimeType;
>     }
> When mime is used as content type, the optional charset part of contentType 
> is ignored. Should there be raised an java.lang.IllegalArgumentException if 
> charset is appended or should the render response characterset part be fed 
> with the contentType charset part. 
> The API is not too clear what to do here, but using JSP directive...
> <jsp:directive.page contentType="image/svg+xml;charset=UTF-8" />
> .. and receiving default encoding in response header without a warning is 
> quite error prone. 
> The 1:1 functionality with HttpServletResponse is the working solution, since 
> at least Apache Jasper seems to use setContentType instead of 
> setCharacterEncoding. 
> I don't know if the Render response MIME is allowed to include charset, but 
> at least RenderResponseImpl#getContentType had a comment saying:
>         // NOTE: in servlet 2.4 we could simply use this:
>         //   return super.getHttpServletResponse().getContentType();



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to