Extending URL Rewriter

If features of URL Rewriter are not enough to you, you can easily add new rules. Adding new rules using this extensibility is not considered as derived work. But please contribute to this project.

When filter starts it reads WEB-INF/rewriter-config.xml and all META-INF/rewriter-config.xml also from classpaths (and jars). So you can create jar with your own META-INF/rewriter-config.xml and add new rules:

<rewriter-config>
    <namespace>http://rewriter.softeu.cz/example/</namespace>

    <rule-definition>
                <rule-name>example</rule-name>
                <rule-class>cz.softeu.rewriter.rules.ExampleFactory</rule-class>
    </rule-definition>
</rewriter-config>

Namespace must be globally unique and it is used as namespace in XML:

<rewriter-config xmlns:e="http://rewriter.softeu.cz/example/">
    <e:example />
</rewriter-config>

Class in &lt;rule-class /&gt; must implement cz.softeu.rewriter.RuleFactory.

public interface RuleFactory {
        /**
         * Read rule from XML Node
         *
         * @param el XML Node for tag
         * @return read Rule
         */
        public Rule read(Element el);
}

We recommend usage of RuleFactoryAdapter.