Nov 03 2008

Menu

Diary
OldIRC
URLs
misc
techie
writing

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

Welcome

Another redesign. This time with BlogPower™. Not sure what will happen about content. Probably will get content until I get bored, then wither.

It seems that I haven't been updating my website as often as I should. There's a lot of information that I want to share with people, but I haven't come up with a simple way of getting it all across.

In the mean time, there is a menu to the left there <--

The reason most people have web pages I do not know, however I do like to be able to find out about people by looking at their web pages. I am less interested to find out about their gerbil though. It is like Internet spying, but spying on what they want you to know. So that people can find a little about me I have written these pages.

My PGP/GPG key is available as this file

There is a more blog-style diary here

Recent Changes

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">
      <value>
        CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
        /slowpages/.*=cachingFilter
        /something/complicated=cachingFilter
      </value>
    </property>
  </bean>

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

 <filter-mapping>
  <filter-name>includeFilter</filter-name>
  <url-pattern>/*</url-pattern>
  <dispatcher>INCLUDE</dispatcher>
 </filter-mapping>

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 IncludedFilterChainProxy.java 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 Link..