I threw together a few filter utilities. Everything (including source) can be found here:

http://funkman.home.comcast.net/

Utilities of interest:
*TimerFilter* - A Filter that lets you spew out how long it took to serve a page.
*ErrorFilter* - Spit or an error code and a file or message.
*NoCacheFilter* - Set all the appropriate no cache headers

EL Wrapper - Make it easy to use EL expressions in servlets or dynamically use EL expressions in JSP's.


All 3 filters extend a class called ConditionFilter. ConditionFilter allows you to decide when the Filter will execute. It's default implementation allows you to use an EL expression. For example:
************
<filter>
<filter-name>ErrorFilter</filter-name>
<filter-class>net.funkman.servletutil.filter.ErrorFilter</filter-class>
<init-param>
<param-name>errorMessage</param-name>
<param-value> <![CDATA[<b>THBBBBBBBTTTTT!</b>]]> </param-value>
</init-param>
<init-param>
<param-name>errorCode</param-name>
<param-value>400</param-value>
</init-param>
<!-- Show error message from 2 - 4 am -->
<init-param>
<param-name>condition</param-name>
<param-value>
${now.HOUR_OF_DAY == 2 or now.HOUR_OF_DAY == 3}
</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>ErrorFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
************


Have fun.


-Tim


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to