Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.2.15, 2.3.10, 2.3-next-M7, 4.0.0-RC2
-
None
-
None
Description
This was discovered in TCK: Spec1135IT.
App Code: https://github.com/jakartaee/faces/tree/master/tck/faces23/systemEvent/src/main ( App was updated, using master branch for latest code)
public void pre(ComponentSystemEvent event) throws IOException { facesContext.setResponseWriter(facesContext.getRenderKit().createResponseWriter(externalContext.getResponseOutputWriter(), "text/html", "UTF-8")); facesContext.getResponseWriter().write("<!-- pre -->"); }
The app uses has a method ("pre") which is invoked before the view has started to be rendered. This method creates a response writer of its own, and then it writes a block of text. Then, by the time MyFaces is ready to create the response writer and set the buffer size, it's already been written to. Thus the ServletException occurs.
Per the Servlet Spec:
setBufferSize throws an IllegalStateException if this method is called after content has been written
Solution seems to be to create a response writer if none exist.
https://github.com/apache/myfaces/blob/db37634747e11ba24216ea384c33ad3c6d2cefcb/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java#L1747
Attachments
Attachments
Issue Links
- links to