regression: Since 1.1.1, JSFs can't send raw data to response
-------------------------------------------------------------

         Key: MYFACES-1130
         URL: http://issues.apache.org/jira/browse/MYFACES-1130
     Project: MyFaces
        Type: Bug
    Versions: Nightly    
    Reporter: Ramon Casha


Since v1.1.1, it is not possible for a JSF page to send raw bytes to the 
response, such as a PDF from JasperReports, because bytes >127 are always 
converted to numeric entities even in raw data sent to 
response.getOutputStream(). Ideally, such character translation should only 
occur on the Writers, not on the OutputStreams, and/or only when the response's 
contentType is of an html/xml type. 

Error is caused in: 
org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(request, 
response, chain)

Recommended solution: if response content type is not a text type (eg, 
"application/pdf"), make no attempt to encode bytes sent directly to 
outputstream.

Workaround: in the doFilter method, after the extendedResponse.finishResponse 
call, if the entendedResponse's contenttype was set to a non-text type, send 
the output directly without any translation. As a stop-gap solution I did this:
        if(extendedResponse.getContentType().contains("pdf")) {
            servletResponse.getOutputStream().write( 
extendedResponse.getBytes() );
            return;
        }


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

Reply via email to