net.sf.j2ep.rules
Class BaseRule

java.lang.Object
  extended by net.sf.j2ep.rules.BaseRule
All Implemented Interfaces:
Rule
Direct Known Subclasses:
AcceptEverythingRule, CompositeRule, DirectoryRule, IPRule, RewriteRule, TimeRule

public abstract class BaseRule
extends java.lang.Object
implements Rule

The BaseRule is an empty rule implementation which can be extended. This class is based on the work by Yoav Shapira for the balancer webapp supplied with Tomcat.

Author:
Anders Nyman

Constructor Summary
BaseRule()
           
 
Method Summary
 java.lang.String process(java.lang.String uri)
          Returns the redirect URI for requests that match this rule.
 java.lang.String revert(java.lang.String uri)
          Returns the reverted URI, this means that if a URI is processed and then reverted it should be the same URI.
 java.lang.String toString()
          Returns a String representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sf.j2ep.model.Rule
matches
 

Constructor Detail

BaseRule

public BaseRule()
Method Detail

process

public java.lang.String process(java.lang.String uri)
Description copied from interface: Rule
Returns the redirect URI for requests that match this rule. Process is used in order to let the rules do rewriting of the URI before being handled by the server. The rule will not any check that a URI is matched before processing it. If you want this type of control make make sure the calling class checks that there is a match before processing.

Specified by:
process in interface Rule
Parameters:
uri - URI to be processed
Returns:
The final URI
See Also:
Rule.process(java.lang.String)

revert

public java.lang.String revert(java.lang.String uri)
Description copied from interface: Rule
Returns the reverted URI, this means that if a URI is processed and then reverted it should be the same URI. revert(process("some random string")) should return "some random string".

Specified by:
revert in interface Rule
Parameters:
uri - URI to be reverted
Returns:
The reverted URI
See Also:
Rule.revert(java.lang.String)

toString

public java.lang.String toString()
Returns a String representation of this object.

Overrides:
toString in class java.lang.Object
Returns:
The string representation