Class CompactPathRule

java.lang.Object
org.eclipse.jetty.rewrite.handler.Rule
org.eclipse.jetty.rewrite.handler.CompactPathRule

public class CompactPathRule extends Rule

Rewrites the URI by compacting to remove occurrences of // and /../.

Optionally decode the path before compacting.

Optionally canonicalize path before compacting.

Examples
isDecoding isCanonicalizing Input Path Resulting Path
false (default) false (default) //foo/bar//baz /foo/bar/baz
false (default) false (default) //foo/../bar//baz /bar/baz
true true //foo/../bar//baz /bar/baz
See Also:
  • Constructor Details

    • CompactPathRule

      public CompactPathRule()
  • Method Details

    • addListener

      public void addListener(CompactPathRule.Listener listener)
    • removeListener

      public boolean removeListener(CompactPathRule.Listener listener)
    • isCanonicalizing

      public boolean isCanonicalizing()
    • setCanonicalizing

      public void setCanonicalizing(boolean canonicalizing)
    • isDecoding

      public boolean isDecoding()
    • setDecoding

      public void setDecoding(boolean decoding)
    • matchAndApply

      public Rule.Handler matchAndApply(Rule.Handler input) throws IOException
      Description copied from class: Rule

      Tests whether the given input Handler (which wraps a Request) matches the rule, and if so returns an output Handler that applies the rule logic.

      If the input does not match, null is returned.

      Specified by:
      matchAndApply in class Rule
      Parameters:
      input - the input Handler that wraps the Request
      Returns:
      an output Handler that wraps the input Handler, or null if the rule does not match
      Throws:
      IOException - if applying the rule fails