Installing Rewriter

  1. If you are not using Maven you need to add this two jars to classpath (eg. WEB-INF/lib/): softeu-rewriter-1.1.8.jar and xom-1.1.jar.

    If you are using Maven add dependency to pom.xml:

    <!-- url rewriter -->
    <dependency>
        <groupId>cz.softeu</groupId>
        <artifactId>softeu-rewriter</artifactId>
        <version>1.1.8</version>
        <scope>runtime</scope>
    </dependency>
  2. Add to web.xml:
    <!-- url rewriter -->
    <filter>
        <filter-name>RewriterFilter</filter-name>
        <filter-class>cz.softeu.rewriter.RewriterFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>RewriterFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
  3. Create WEB-INF/rewriter-config.xml:
    <rewriter-config xmlns:b="http://rewriter.softeu.cz/basic/">
        <b:regex>
            <from>^/news/(.*)$</from>
            <to>/news.jsf?id=$1</to>
        </b:regex>
    </rewriter-config>

    There is more information about configuration or extending.