tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lilianne E. Blaze" <>
Subject Re: Using RequestDispatcher.include() outside of Request/Response cycle.
Date Wed, 10 Oct 2007 02:34:23 GMT
Consider using either Request / Response Wrappers subclassed and
modified so they simply return 0 / null / "" / ignore output, or google
for "servlet api mock objects" or something similar.
Ages ago I wrote something similar, where specified pages were called on
webapp start / stop. Don't ask :/
It was on Tomcat 4.0, but I believe there's nothing in the specs that
prohibit such (ab)use, so it should work with any servlet container.

Greetings, Lilianne E. Blaze

Andrei Tchijov wrote:
> Hi,
>   I have a valve which detects some events in life-cycle of a web
> application ( like successful login/failed login/logout ) and invokes
> some configurable JSP page to let it perform some audit auctions (
> like putting records in the table which trace access to application
> ).  It works fine, the only problem is auditing session timeouts.  I
> can (and do) add session listener, so it is not a problem to detect
> that session timed out. The problem is how to invoke my audit JSP
> page. RequestDispatcher.include() require Request and Response objects
> which are obviously not accessible inside SessionEvent callback. 
> Should I create some sort of "fake" Request/Response objects? Can I
> reuse some Request/Response objects from earlier (like when valve
> detected creation of the session)?  Audit JSP page does NOT produce
> any output and it does NOT require any information from Request, so
> this Request/Response objects only need to be able to make
> RequestDispatcher.include() happy.
>   Your thoughts will be highly appreciated,
> Andrei Tchijov
> ---------------------------------------------------------------------
> To start a new topic, e-mail:
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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

View raw message