XForms/URL Rewriter

Motivation

edit

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">
            <Arg>/db/app/data/path/to/old/file.xml</Arg>
            <Arg>/newfile.xml</Arg>
         </Call>

         <!-- redirect an entire directory of content -->
         <Call name="addRewriteRule">
            <Arg>/some/old/context/*</Arg>
            <Arg>/test/dump/newcontext</Arg>
         </Call>

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

      </New>
   </Set>
</Configure>

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

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
Next Page: Web Service Tester | Previous Page: Dashboard Builder
Home: XForms