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:
http://download.oracle.com/docs/cd/B32110_01/web.1013/b28959/filters.htm

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:
http://www.nabble.com/file/p19265999/AjaxPreparationFilter.tar
AjaxPreparationFilter.tar 
-- 
View this message in context: 
http://www.nabble.com/Filter-cuts-response-in-Tomcat-5.5.20-tp19265999p19265999.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to