techie : blog : programming : java



More content will be added to fill this space at some point in the future.

home :: techie :: blog :: programming :: java

ACEGI FilterChainProxy and included requests

In our Spring application we use the FilterChainProxy in order to use beans as filters in our tomcat web.xml file. This moves the configuration into a different bit of XML, and allows us to configure the URLs that our filters apply to in a more flexable way than that available in the Servlet 2.4 spec.

For example, we can cache some URLs by defining

  <bean id="includeFilter" class="org.acegisecurity.util.FilterChainProxy">
    <property name="filterInvocationDefinitionSource">

I want to use this for included requests by using the following (and a bit more) in my web.xml.


Unfortunately the URLs that are compared in the FilterChainProxy, are those of the original page, not that of the include.

To solve this, I've written which extends FilterChainProxy and wraps the setter of the filterInvocationDefinitionSource, so that the source that gets injected has been altered. It will make sure that the FilterInvocation passed to getAttributes will return the included URL, rather than the orginal URL.

I'm not sure that this is the best way, but it seemed the least invasive way of getting the result I want. If anyone knows of a better hook into ACEGI then please let me know.

I also posted to the spring forum about this.

Last updated: 21:29, 11 Mar 2008 [ /techie/blog/programming/java ] Link..