org.mortbay.jetty.handler.rewrite
Class LegacyRule

java.lang.Object
  extended by org.mortbay.jetty.handler.rewrite.Rule
      extended by org.mortbay.jetty.handler.rewrite.LegacyRule

public class LegacyRule
extends Rule

Rule implementing the legacy API of RewriteHandler

Author:
gregw

Field Summary
 
Fields inherited from class org.mortbay.jetty.handler.rewrite.Rule
_handling, _terminating
 
Constructor Summary
LegacyRule()
           
 
Method Summary
 void addRewriteRule(java.lang.String pattern, java.lang.String prefix)
          Add a path rewriting rule
 org.mortbay.jetty.servlet.PathMap getRewrite()
          Returns the map of rewriting rules.
 java.lang.String matchAndApply(java.lang.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(org.mortbay.jetty.servlet.PathMap rewrite)
          Sets the map of rewriting rules.
 
Methods inherited from class org.mortbay.jetty.handler.rewrite.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 java.lang.String matchAndApply(java.lang.String target,
                                      javax.servlet.http.HttpServletRequest request,
                                      javax.servlet.http.HttpServletResponse response)
                               throws java.io.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:
java.io.IOException - TODO

getRewrite

public org.mortbay.jetty.servlet.PathMap getRewrite()
Returns the map of rewriting rules.

Returns:
A PathMap of the rewriting rules.

setRewrite

public void setRewrite(org.mortbay.jetty.servlet.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(java.lang.String pattern,
                           java.lang.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 © 2009 Mortbay Consulting Pty. Ltd. All Rights Reserved.