Caucho Forums  

This forum is permanently closed because of spam. For free community support, please visit Google Groups:

Go Back   Caucho Forums > Quercus

Thread Tools Display Modes
Old 11-28-2012, 12:38 PM
jornvl90 jornvl90 is offline
Junior Member
Join Date: Nov 2012
Posts: 2
Default Catching response with java filters


What I want to do is having some java filters ( where the request for a php-page comes in. The request passes every filter in the chain, they do some things on the request and the last filter sends the request further to the quercus php servlet. This is going well. The web.xml file is written which does a mapping to the filters for the urls "/*" and the quercus mapping is done for the urls "*.php".

Now when a request is made for a JSP file the filters are invoked one after another. When the request finally comes in the java servlet, the servlet creates the response page. The response traverses the filters in reverse order. The last filter sends it to the client.

This is what I want that happens for PHP pages: the request for a php page comes in. The web.xml directs him to a chain of java filters with finally the quercus php servlet. This servlet handles the php request and generates a response from the requested php-file. Uptil this, everything works fine. But the quercus servlet sets the response directly on the cable. So it flushes the response himself to the client by calling the reponse.getWriter etc..(?).
The java program then traverses the filterchain in reverse order, and this is indeed what I want but I cannot change the response anymore, because the quercus servlet already sent it out.

So basically I want that the quercus servlet does not send the response himself, but sets it in a java ServletResponse so I can change this response in the filters when they are processed in the reverse order. Can I do this, do I need to change the source code of quercus..?
Reply With Quote
Old 11-28-2012, 09:13 PM
nam nam is offline
Join Date: Aug 2009
Posts: 337

Hi jornvl90,

It looks like we're closing the ServletOutputStream by mistake, thereby committing the response. On Resin, this has no effect because Resin's implementation of ServletOutputStream.close() does nothing. However, other implementations like Tomcat's may behave differently.

This is a bug and I just committed a fix for it ( You can try out the fix by checking out Resin sources and compiling everything:

Checkout instructions
1. svn checkout svn:// resin
2. cd resin
3. ant

Jars will be resin/lib/resin-kernel.jar and resin/lib/quercus.jar.
Reply With Quote

catch, filters, java, response

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 08:05 AM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.