XForms/URL Rewriter

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Motivation[edit | edit source]

You want a nice easy-to-use form to configure and test URL rewriting rules that can be use with the Jetty web server.

Here is the overall structure of the Jetty configuration file:

<Configure id="Server" class="org.mortbay.jetty.Server">
   <Get id="oldhandler" name="handler"/>
   <Set name="handler">
      <New id="Rewrite" class="org.mortbay.jetty.handler.rewrite.RewriteHandler">

         <!-- redirect an entire directory of content -->
         <Call name="addRewriteRule">

         <!-- redirect an entire directory of content -->
         <Call name="addRewriteRule">

         <!-- add a regex rule -->
         <Call name="addRule">
               <New class="org.mortbay.jetty.handler.rewrite.RewriteRegexRule">
                  <Set name="regex">/test/dump/regex/([^/]*)/(.*)</Set>
                  <Set name="replacement">/test/dump/$2/$1</Set>


You will note that there are two blocks of repeating elements. One for addRule and one for addRewriteRule. Our XForms application with have two repeating structures, one for each of these rules.

Structure of the form[edit | edit source]

Our form will have a single line for each rewrite rule. When you click on that rule it will display an inspector below that has a type-sensitive editor for that rule. Under the rule there will be a button to test the rule by sending the rule to a regex test server. This will run the rule on the input test cases and return the results.

Discussion[edit | edit source]

Next Page: Web Service Tester | Previous Page: Dashboard Builder
Home: XForms