com.caucho.server.rewrite
Class AbstractRuleWithConditions

java.lang.Object
  extended by com.caucho.server.rewrite.AbstractRule
      extended by com.caucho.server.rewrite.AbstractRuleWithConditions
All Implemented Interfaces:
FilterChainMapper, Rule
Direct Known Subclasses:
AcceptRule, DispatchRule, ErrorRule, ForwardRule, LoadBalanceRule, MatchRule, MovedRule, ProxyRule, RedirectRule, RewriteRule, SetRule

public abstract class AbstractRuleWithConditions
extends AbstractRule


Nested Class Summary
 
Nested classes/interfaces inherited from class com.caucho.server.rewrite.AbstractRule
AbstractRule.RewriteRuleAdmin
 
Constructor Summary
protected AbstractRuleWithConditions(RewriteDispatch rewriteDispatch)
           
 
Method Summary
 void addAnd(AndConditions condition)
          Add a list of conditions that must pass for the rule to match.
 void addNot(NotConditions condition)
          Add a list of conditions that must not pass for the rule to match.
 void addOr(OrConditions condition)
          Add a list of conditions one of which must pass for the rule to match.
 void addUnless(ConditionConfig condition)
          Add a condition that must not pass for the rule to match.
 void addWhen(ConditionConfig condition)
          Add a condition that must pass for the rule to match.
 void destroy()
           
abstract  FilterChain dispatch(java.lang.String targetUri, java.lang.String queryString, FilterChain accept, FilterChainMapper next)
          Returns the FilterChain to invoke if the rule is successful, null indicates that the rule does not invoke a FilterChain.
 java.util.regex.Pattern getFullUrlRegexp()
           
 java.util.regex.Pattern getRegexp()
           
 void init()
           
 FilterChain map(java.lang.String uri, java.lang.String queryString, FilterChain accept)
           
 FilterChain mapImpl(java.lang.String uri, java.lang.String queryString, FilterChain accept)
           
protected  void required(java.lang.Object value, java.lang.String name)
          Throws an exception if the passed value is null.
 java.lang.String rewrite(java.lang.String uri, java.util.regex.Matcher matcher)
          Return a rewritten uri to use for the rest of the processing of rewrite-dispatch.
 void setFullUrlRegexp(java.util.regex.Pattern regexp)
          Sets the regular expression pattern that must match the uri for the rule to match, required.
 void setRegexp(java.util.regex.Pattern regexp)
          Sets the regular expression pattern that must match the uri for the rule to match, required.
 
Methods inherited from class com.caucho.server.rewrite.AbstractRule
clearCache, createAdmin, getFailFilterChainMapper, getLogPrefix, getName, getPassFilterChainMapper, getRewriteDispatch, isEnabled, register, setDisableAt, setEnableAt, setEnabled, setFailFilterChainMapper, setLogPrefix, setName, setPassFilterChainMapper, unregister
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.caucho.server.rewrite.Rule
getTagName
 

Constructor Detail

AbstractRuleWithConditions

protected AbstractRuleWithConditions(RewriteDispatch rewriteDispatch)
Method Detail

setRegexp

public void setRegexp(java.util.regex.Pattern regexp)
Sets the regular expression pattern that must match the uri for the rule to match, required.


getRegexp

public java.util.regex.Pattern getRegexp()

setFullUrlRegexp

public void setFullUrlRegexp(java.util.regex.Pattern regexp)
Sets the regular expression pattern that must match the uri for the rule to match, required.


getFullUrlRegexp

public java.util.regex.Pattern getFullUrlRegexp()

addAnd

public void addAnd(AndConditions condition)
Add a list of conditions that must pass for the rule to match.


addOr

public void addOr(OrConditions condition)
Add a list of conditions one of which must pass for the rule to match.


addNot

public void addNot(NotConditions condition)
Add a list of conditions that must not pass for the rule to match.


addWhen

public void addWhen(ConditionConfig condition)
Add a condition that must pass for the rule to match.


addUnless

public void addUnless(ConditionConfig condition)
Add a condition that must not pass for the rule to match.


required

protected void required(java.lang.Object value,
                        java.lang.String name)
                 throws ConfigException
Throws an exception if the passed value is null.

Throws:
ConfigException

init

public void init()
          throws ConfigException
Overrides:
init in class AbstractRule
Throws:
ConfigException

map

public FilterChain map(java.lang.String uri,
                       java.lang.String queryString,
                       FilterChain accept)
                throws ServletException
Throws:
ServletException

mapImpl

public FilterChain mapImpl(java.lang.String uri,
                           java.lang.String queryString,
                           FilterChain accept)
                    throws ServletException
Throws:
ServletException

rewrite

public java.lang.String rewrite(java.lang.String uri,
                                java.util.regex.Matcher matcher)
Return a rewritten uri to use for the rest of the processing of rewrite-dispatch.

Parameters:
matcher - a Matcher obtained from doing a regexp comparison, or null if there was no regexp comparison

dispatch

public abstract FilterChain dispatch(java.lang.String targetUri,
                                     java.lang.String queryString,
                                     FilterChain accept,
                                     FilterChainMapper next)
                              throws ServletException
Returns the FilterChain to invoke if the rule is successful, null indicates that the rule does not invoke a FilterChain.

Parameters:
targetUri - the target uri, possibly rewritten
accept - a FilterChain that stops evaluation of rewrite rules and
next -
Throws:
ServletException

destroy

public void destroy()
Specified by:
destroy in interface Rule
Overrides:
destroy in class AbstractRule