[ http://issues.apache.org/jira/browse/MYFACES-605?page=comments#action_12330971 ]
Mike Kienenberger commented on MYFACES-605: ------------------------------------------- Tanju, Thanks for taking the time to read and comment on this issue. I hadn't consulted the spec, and foolishly assumed that a responseStream/responseWriter was available during the invokeApplication phase. It's now clear to me that trying to generate non-JSF response content is difficult to do cleanly, despite the incorrect examples provided elsewhere :) I'm going to cheat and just continue to retrieve the responseStream from my HttpResponse directly since it seems like less of a hack than trying to delay my response to a phase that should never be called. Please close this issue as invalid or won't fix. > FacesContext.getResponseStream/getResponseWriter unimplemented > -------------------------------------------------------------- > > Key: MYFACES-605 > URL: http://issues.apache.org/jira/browse/MYFACES-605 > Project: MyFaces > Type: Bug > Components: Implementation > Versions: 1.1.1 > Reporter: Mike Kienenberger > Attachments: ServletFacesContextImpl.java.patch.txt > > I'm trying to generate a downloadable file link, and I'm using: > FacesContext facesContext = FacesContext.getCurrentInstance(); > OutputStream responseStream = facesContext.getResponseStream(); > but responseStream is coming back null. > A search through the code seems to indicate that the only thing to call > ServletFacesContextImpl.setResponseStream is > FacesContextWrapper.setResponseStream(), and nothing calls this method. > The same thing appears to be true for responseWriter. > It looks like these methods should be delegating to the ExternalContext > rather than holding local copies of the values, especially since the external > context has valid references. > facesContext= ServletFacesContextImpl (id=117) > _externalContext= ServletExternalContextImpl (id=122) > _servletResponse= ExtensionsResponseWrapper (id=157) > printWriter= null > response= ServletHttpResponse (id=165) > stream= ByteArrayOutputStream (id=167) > _renderResponse= false > _responseComplete= false > _responseStream= null > _responseWriter= null > However, I'm not sure the best way of doing this. One way would be to > typecast ExternalContext to either a ServletExternalContextImpl or a > PortletExternalContextImpl and follow the chain of objects. > I can create a patch to do this if there's confirmation that this is the best > way to go about it. -- 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
