tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Allistair Crossley" <Allistair.Cross...@QAS.com>
Subject [OT] getOutputStream() has already been called for this response - ignored content-disposition header
Date Mon, 21 Feb 2005 17:12:00 GMT
Hi Guys,

I hope this not entirely off-topic. Just the other day I started getting a getOutputStream()
has already been called for this response error when I was calling a servlet that sends back
a CSV file (uses Content-Disposition also to cause a popup save prompt). 

This had been working for some time without problem on our test server and production server
and the other day just the test box instance started prompting this error. 

I am aware what the error means and what causes it - I found that although I had set the content
type and content disposition correctly, both those headers were being ignored, and by that
time my servlet had called response.getOutputStream, but because the headers were not being
respected somewhere, my servlet returned a JSP view that would also require calling response.getOutputStream.

I fiddled for hours on this, and found that if I called flush on the output stream each time
I wrote a CSV row, this caused the headers to be respected, my Save prompt appeared and all
was well. I put it down to experience.

But I have just found that an auto-PDF generating features is exhibiting the precise same
problem, and this time I am using JasperReports - a 3rd party API for generating the PDF and
all I am allowed to pass it is response.getOutputStream() direct into the streamToPDF function.

Therefore I have to return to my original pondering over what could possibly cause all our
streaming functions to start exhibiting this problem. And why would flush correct this even
though I explicity set the content-disposition file header.

Any thoughts very much appreciated.

Allistair.

java.lang.IllegalStateException: getOutputStream() has already been called for this response
	org.apache.catalina.connector.Response.getWriter(Response.java:596)
	org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:186)
	org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:124)
	org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:117)
	org.apache.jasper.runtime.JspWriterImpl.flush(JspWriterImpl.java:172)
	org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:887)
	org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:460)
	org.apache.jsp.views.core.layout.page.layout_jsp._jspx_meth_tiles_insert_0(org.apache.jsp.views.core.layout.page.layout_jsp:361)
	org.apache.jsp.views.core.layout.page.layout_jsp._jspService(org.apache.jsp.views.core.layout.page.layout_jsp:122)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1056)
	org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:261)
	org.apache.struts.tiles.TilesRequestProcessor.processTilesDefinition(TilesRequestProcessor.java:237)
	org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:300)
	org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:231)
	org.apache.struts.action.ActionServlet.process(ActionServlet.java:1158)
	org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	com.qas.newmedia.common.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:65)


<FONT SIZE=1 FACE="VERDANA,ARIAL" COLOR=BLUE> 
-------------------------------------------------------
QAS Ltd.
Developers of QuickAddress Software
<a href="http://www.qas.com">www.qas.com</a>
Registered in England: No 2582055
Registered in Australia: No 082 851 474
-------------------------------------------------------
</FONT>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message