Java – call Tomcat dofilter() with the submitted response

I have a Tomcat filter that delegates requests to a processing object based on the URL This is the only filter in filterchain I have an Ajax application that can break this filter through a large number of requests

Recently, I noticed a problem that the dofilter method of the filter usually uses the submitted response as a parameter call (internally, it is a hyena response marked as submitted)

In my opinion, the only way this can happen is if the recycle () method is not called on the hyena response I've checked to make sure I don't keep references to any request, response, OutputStream or writer objects In addition, I make sure that OutputStream is closed in the finally block However, this does not solve the problem

It sounds like I'm doing something abusing the servlet container, but I can't track it

Solution

I tried Tomcat 6.16 and 6.18 This is definitely the only filter in the chain

Something seems to retain a reference to the servlet OutputStream I wrap the ServletOutputStream in my own OutputStream and then make sure that the reference is destroyed This solves the problem, so I no longer see the incoming submitted response

This is a strange side effect of holding references But I don't think it qualifies as a Tomcat error More likely imageio An error in createimageoutputstream(), I doubt if it has a reference

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>