paultuckey / urlrewritefilter

A Java Web Filter with functionality like Apache's mod_rewrite
http://tuckey.org/urlrewrite/
Other
335 stars 144 forks source link
java-web-filter mod-rewrite rewrite-urls

UrlRewriteFilter

UrlRewriteFilter Web Site | Documentation

Based on the popular and very useful mod_rewrite for apache, UrlRewriteFilter is a Java Web Filter for any J2EE compliant web application server (such as Resin, Jetty or Tomcat), which allows you to rewrite URLs before they get to your code. It is a very powerful tool just like Apache's mod_rewrite.

URL rewriting is very common with Apache Web Server (see mod_rewrite's rewriting guide) but has not been possible in most java web application servers. The main things it is used for are:

!UrlRewriteFilter uses an xml file, called urlrewrite.xml (it goes into the WEB-INF directory), for configuration. Most parameters can be Perl5 style Regular Expressions or Wildcard Expressions. This makes it very powerful indeed.

See the manual for more information.

Quick Start

For Servlet API 4 or less (javax), use the old version 4.x

    <dependency>
        <groupId>org.tuckey</groupId>
        <artifactId>urlrewritefilter</artifactId>
        <version>4.0.3</version>
    </dependency>

You can visit http://127.0.0.1:8080/rewrite-status (or whatever the address of your local webapp and context) to see output (note: this page is only viewable from localhost).

Previously on Google Code: http://code.google.com/p/urlrewritefilter.