tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jesse Klaasse <>
Subject Filter cuts response in Tomcat 5.5.20
Date Tue, 02 Sep 2008 08:19:10 GMT

For a few days, I have been breaking my head over this issue:

My goal is to create a filter which detects Ajax calls (using jQuery for
Ajax, which adds "X-Requested-With: XMLHttpRequest" to the request headers).
If some jsp is requested by an Ajax call, I want to process the jsp's output
with this filter (extract the body, correct some entities and stuff, but
this is not really important to know for this issue, especially since I
don't even get this far).

I have implemented the filter structure as outlined here:

With one adaptation: in the Filter I check for the "X-Requested-With:
XMLHttpRequest" header, and when it is there, I do the pre-post thing
mentioned in the article. If it's not, it just continues the chain. I left
the rest of the files untouched.

However, it isn't working as it should be. I actually see the "PRE" and
"POST" lines in the Ajax output, however, most of the time there is nothing
between them. And when I print the response length, it's 0 most of the time.
This is all working fine using our old development platform (based on Resin
3.0.14), but it isn't working on the new one (based on Tomcat 5.5.20).

When I request the same url via a browser, all is working fine. Also, when I
disable the filter, all is working fine (however, without my desired
changes). So it has to be in the filter's code.

An idea, anyone?

I have attached the relevant java code for the filter to this message in one
tar file:
View this message in context:
Sent from the Tomcat - User mailing list archive at

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message