CleverCloud / Quercus

Java implementation of PHP, by Caucho's Technology, Clever Cloud Development Branch
http://github.com/CleverCloud/Quercus/wiki
GNU General Public License v2.0
50 stars 12 forks source link

QuercusServletImpl.openWrite(HttpServletResponse response) not robust enough #37

Open terefang opened 13 years ago

terefang commented 13 years ago

hi!

i've encountered a realy nasty misfeature of illegalstateexception in tomcat 7 with jsp includes.

"protected WriteStream QuercusServletImpl.openWrite(HttpServletResponse response)" tries to get an outputstream but the jsp-include implementation in tomcat 7 requieres the jsp-writer to be used.

since i cant currently use git i have included the fix below:

//------------------------------------------------------------------ protected WriteStream openWrite(HttpServletResponse response) throws IOException { WriteStream ws;

try {
    OutputStream out = response.getOutputStream();
    ws = Vfs.openWrite(out);
} 
catch (Exception ex) // Jsp/IllegalState try the writer
{
    Writer out = response.getWriter();
    ws = Vfs.openWrite(out);
}
return ws;

} //------------------------------------------------------------------

Kdecherf commented 13 years ago

Hi,

Thanks for the report, we look at this.