Content Negotiation Filter

As part of the (limited) linked data I provide on this website I implemented a content negotiation filter to provide the 303 redirects. It is configured with an XML file that describes the possible variants. The content negotiation algorithm is based on the Apache Negotiation Algorithm but lacks support for the encoding and character set.

I implemented this myself because when I was trying to find out how I should do this I kept finding Paul Tuckey's UrlRewriteFilter and JAX-RS which uses annotations. The UrlRewriteFilter only supports string matching on the accept header and 302 redirects. JAX-RS and annotations had nothing to do with how I was implementing my website.

I used Maven as the build tool for this. Some of you may have heard me say that I prefer Ant and this is true. One of the problems I have with Maven is that the lifecycles make it unsuitable for persistent data stores, this does not apply here. What I like about Maven is the dependency management, which I usually take advantage of using Ivy. Ivy does support publishing to a repository but I felt that it would be more straight forward to use Maven and there wasn't anything I wanted to do that Maven would make difficult.

I had intended to provide this as three artifacts but looking at Sonatype and the requirement to raise a ticket I will provide a single artifact. Two of the three artifacts aren't much of an end product. The Maven generated site is available at http://www.mattunderscore.com/content-negotiation/. I am sure you will all be glad to learn that the next release will contain automated testing.

For those of you interested in linked data for this project, see here: