org.eclipse.jetty.rewrite.handler

## Class LegacyRule

- java.lang.Object
- - org.eclipse.jetty.rewrite.handler.Rule
  - - org.eclipse.jetty.rewrite.handler.LegacyRule

-     public class LegacyRule
      extends Rule

  Rule implementing the legacy API of RewriteHandler

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.eclipse.jetty.rewrite.handler.Rule

      `Rule.ApplyURI`

  - ### Field Summary

    - ### Fields inherited from class org.eclipse.jetty.rewrite.handler.Rule

      `_handling, _terminating`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `LegacyRule()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addRewriteRule(String pattern, String prefix)` Add a path rewriting rule
    `PathMap` | `getRewrite()` Returns the map of rewriting rules.
    `String` | `matchAndApply(String target, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)` This method calls tests the rule against the request/response pair and if the Rule applies, then the rule's action is triggered.
    `void` | `setRewrite(PathMap rewrite)` Sets the map of rewriting rules.

    - ### Methods inherited from class org.eclipse.jetty.rewrite.handler.Rule

      `isHandling, isTerminating, setHandling, setTerminating, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### LegacyRule

          public LegacyRule()

  - ### Method Detail

    - #### matchAndApply

          public String matchAndApply(String target,
                             javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response)
                               throws IOException

      Description copied from class: `Rule`
      This method calls tests the rule against the request/response pair and if the Rule applies, then the rule's action is triggered.
      Specified by:
        `matchAndApply` in class `Rule`
      Parameters:
        `target` - The target of the request
      Returns:
        The new target if the rule has matched, else null
      Throws:
        `IOException` - TODO

    - #### getRewrite

          public PathMap getRewrite()

      Returns the map of rewriting rules.
      Returns:
        A `PathMap` of the rewriting rules.

    - #### setRewrite

          public void setRewrite(PathMap rewrite)

      Sets the map of rewriting rules.
      Parameters:
        `rewrite` - A `PathMap` of the rewriting rules. Only prefix paths should be included.

    - #### addRewriteRule

          public void addRewriteRule(String pattern,
                            String prefix)

      Add a path rewriting rule
      Parameters:
        `pattern` - The path pattern to match. The pattern must start with / and may use a trailing /* as a wildcard.
        `prefix` - The path prefix which will replace the matching part of the path.

Copyright © 1995-2015 Mort Bay Consulting. All Rights Reserved.