How to Include a Prefix to a Tapestry Rewriter

Apache's Tapestry framework provides you with dynamic cache of programming libraries and classes that you can reference in the development of your Java web applications. When adding an expression to events in your application's source code, prefixes can be used to tell Tapestry how to evaluate the expression. Prefixes are generally used in Tapestry to configure components of the framework, but they can be useful in Tapestry's URL rewriting script as well. If you need to chain several URL rewrites together, you can use the "after:" prefix to set the order of your rules.

Instructions

    • 1

      Launch your integrated development environment, called IDE. Select the "Open" option from the application's "File" heading, and then import your Tapestry project into the program.

    • 2

      Scroll through your project's code to locate the rewritten URL script. Look for the line with "new URLRewriterRule()" to locate the beginning of the script, and then scroll down to the rule configuration module, "configuration.add("rule1name", rule1)," at the bottom of the script.

    • 3

      Type "configuration.add("nextrulename", rule2, "after:rule1");" beneath the first "configuration.add" line. Replace "nextrulename" with the name of the second rule in the rewriter script. Each URL management rule is designated by a "URLRewriterRule rule#" heading, where "#" would be the rule's numerical position in the script. Replace "rule2" in the template with the rule's position inside of the script. For example, the fourth rule would be "rule4." Follow this template for each subsequent rule.

    • 4

      Click on the "Save" button in your IDE's toolbar and save your project's changes.

Related Searches:

References

Comments

Related Ads

Featured