net.sf.j2ep.model
Interface Rule

All Known Implementing Classes:
AcceptEverythingRule, BaseRule, CompositeRule, DirectoryRule, IPRule, RewriteRule, TimeRule

public interface Rule

The Rule interface is implemented by the rules for the reverse proxy. Based on the work by Yoav Shapira for the balancer webapp.

Author:
Anders Nyman

Method Summary
 boolean matches(HttpServletRequest request)
          Determines if the given request matches the rule.
 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.
 

Method Detail

matches

boolean matches(HttpServletRequest request)
Determines if the given request matches the rule.

Parameters:
request - The request
Returns:
true if the request is matched, otherwise false

process

java.lang.String process(java.lang.String uri)
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.

Parameters:
uri - URI to be processed
Returns:
The final URI

revert

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. revert(process("some random string")) should return "some random string".

Parameters:
uri - URI to be reverted
Returns:
The reverted URI