StripesFilter should not do response.setCharacterEncoding
---------------------------------------------------------

                 Key: STS-639
                 URL: http://www.stripesframework.org/jira/browse/STS-639
             Project: Stripes
          Issue Type: Bug
    Affects Versions: Release 1.5
         Environment: Stripes 1.5, Tomcat 6.0, Java 1.6, Windows 2000
            Reporter: Jan Moravec


I think StripesFilter should not set any _response_ properties such as the 
encoding. From StripesFilter:

===
if (encoding != null) {
  httpResponse.setCharacterEncoding(encoding);
}
===

It should be a sole responsibility of a Resolution/JSP page to provide the 
response encoding (if necessary). I also do not think that any spec dictates 
that the response encoding must automatically match the request encoding - i 
admit it is a common case, but it is not 100% of cases.

I bumped into this problem when one of my action beans (providing PDF download 
functionality) returned a stream with PDF data through a StreamingResolution 
instance. The action bean specified the "application/pdf" content type, but in 
the response I kept getting:

Content-Type: application/pdf;charset=UTF-8

Obviously, the charset part does not make any sense with the application/pdf 
content-type and it confuses some browsers. There did not seem to be a way to 
reset the response encoding to get rid of the charset part - 
response.setCharacterEncoding(null) did not work (possibly a bug in Tomcat). In 
the end I had to invoke response.reset() in the action bean which makes the 
charset part disappear from the content-type.

For further reference, you can check "Inadvertent content-type charset" thread 
in the Stripes-Users mailing list.

Thank you,
Jan Moravec

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://www.stripesframework.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to