org.w3c.www.protocol.http.proxy
Class Rule

java.lang.Object
  extended by org.w3c.www.protocol.http.proxy.Rule
All Implemented Interfaces:
Comparable

public class Rule
extends java.lang.Object
implements Comparable


Field Summary
protected static java.lang.String[] names
           
 
Constructor Summary
Rule()
          Empty constructor for dynamic instantiation.
 
Method Summary
 Reply apply(Request request)
          Apply given rule to the given request.
static Rule createRule(java.lang.String[] tokens, int offset, int length)
          Create a rule, given an array of String.
 java.lang.String getHost()
           
 java.lang.String getRuleArgs()
           
 java.lang.String getRuleName()
           
static java.lang.String[] getRulesName()
           
 java.lang.String getStringValue()
           
 boolean greaterThan(Comparable comp)
           
protected  void initialize(java.lang.String[] tokens, int offset, int length)
          Initialize the rule with given set of tokens.
 java.lang.String toString()
           
 void writeRule(java.io.DataOutputStream out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

names

protected static java.lang.String[] names
Constructor Detail

Rule

public Rule()
Empty constructor for dynamic instantiation.

Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getStringValue

public java.lang.String getStringValue()
Specified by:
getStringValue in interface Comparable

greaterThan

public boolean greaterThan(Comparable comp)
Specified by:
greaterThan in interface Comparable

writeRule

public void writeRule(java.io.DataOutputStream out)
               throws java.io.IOException
Throws:
java.io.IOException

getHost

public java.lang.String getHost()

getRuleName

public java.lang.String getRuleName()

getRuleArgs

public java.lang.String getRuleArgs()

initialize

protected void initialize(java.lang.String[] tokens,
                          int offset,
                          int length)
                   throws RuleParserException
Initialize the rule with given set of tokens.

Parameters:
tokens - The token array.
offset - Offset within above array, of tokens to initialize from.
length - Total number of tokens in above array.
Throws:
RuleParserException - If the rule couldn't be initialized from given tokens.

createRule

public static Rule createRule(java.lang.String[] tokens,
                              int offset,
                              int length)
                       throws RuleParserException
Create a rule, given an array of String.

Parameters:
tokens - Parsed tokens, as a String array.
offset - Offset of the rule tokens within above array.
length - Total number of available tokens.
Throws:
RuleParserException - If no rule could be created out of given tokens.

getRulesName

public static java.lang.String[] getRulesName()

apply

public Reply apply(Request request)
Apply given rule to the given request.

Parameters:
request - The request to apply the rule to.