This is unrelated, but worth mentioning to other people converting 
over from Resin 3.0.x:

We had this problem when converting over from Resin 3.0.x.:   The 
problem is that Resin 4.0.x now outputs white space in each iteration of 
<c:forEach ...></c:forEach> loops, and other places where Resin 3.0.x 
did not.  That causes problems with Resin 3.0.x and older code that has 
c:redirect, sendRedirect, jsp:forward, response.reset(), and any other 
calls that rely on the response not being committed.   The reason is 
that the buffer used to cache up a response prior to writing out to 
response's outputStream can fill up very quickly compared with earlier 
versions and causes the response to commit very fast (with a ton of 
white space to boot).

The fix is, if you are doing <jsp:include page=""> with loops in it, to do:

<c:import url="" var="debug"> .. </c:import>

instead.  Instead of the output being dumped directly to response's 
output buffer, the white space will go to a variable that you can ignore 
(and comes in handy a development environment).

If you are not including/importing anything and have a bunch of 
<c:forEach> in your code prior to your redirect/clear/reset, try 
throwing those in a second JSP and doing a <c:import .. var="debug"> in 
order to trap the white space.

This way your response.buffer won't commit prematurely and you can still 
do redirects/resets.

I know this is unrelated but we had issues with it, and I thought I 
would post it for others searching for redirect/clear/reset issues.

Aaron


On 8/30/2010 10:33 AM, Morawetz, Martin wrote:
> wMorawetz, Martin wrote:
>>> Hi all,
>>>
>>> Some JSPs produce following error Stacktrace in our Java-log:
>>>
>>> java.io.IOException: can't clear response after writing headers
>>>
>>> at
> com.caucho.server.http.ResponseStream.clear(ResponseStream.java:233)
>>> at
>>>
>> com.caucho.server.http.HttpServletResponseImpl.getOutputStream(HttpServ
> letResponseImpl.java:137)
>>> :
>>>
>>> :
>>>
>>> The Exception gets thrown at the line
>>>
>>> sosOut = response.getOutputStream();
>>>
>>> This code work on all other resin installations (for years now)
>>>
>>> The only difference to our other resin installations that I'm aware
> of,
>>> is that resin and apache are on two separate machines now.
>>>
>>> We use Resin Pro 4.0.9.
>>>
>>> Any ideas what might cause this exception?
>>>
>> Resin is being more strict about conforming to the servlet/JSP spec.
>>
>> Is there an output flush() anywhere before that clear()?
>>
>> -- Scott
> Yes there is, and removing the out.flush() resolves the issue.
> Was that 'being more strict' a recent change? The same code
> works on a different server with Resin 4.0.0 installed.
>
> Regards, Martin
>
> "The information in this e-mail and in any attachments is confidential and 
> intended solely
> for the attention and use of the named addressee(s). This information may be 
> subject to legal,
> professional or other privilege and further distribution of it is strictly 
> prohibited without
> our authority. If you are not the intended recipient, you are not authorised 
> to and must not
> disclose, copy, distribute, or retain this message or any part of it, and 
> should notify us
> immediately.
>
> This footnote also confirms that this email has been automatically scanned 
> for the presence
> of computer viruses, profanities and certain file types."
>
>
>
> _______________________________________________
> resin-interest mailing list
> resin-interest@caucho.com
> http://maillist.caucho.com/mailman/listinfo/resin-interest
>
>



_______________________________________________
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest

Reply via email to