Package org.apache.synapse.commons.evaluators

## Class Parser

- java.lang.Object
- - org.apache.synapse.commons.evaluators.Parser

-     public class Parser
      extends Object

  This class is used to parse a Given HTTP request against a set of rules.

  A Rule has a priority. If a HTTP request matches the Rule, parser returns the priority corresponding to that rule.

  Here is the syntax of the configuration used to building the parser

       <conditions [defualtPriority = "int"]>
           <condition priority = "">
              <and/> | <or> | <not> | <match> | <equal>
           </condition>
       </conditions>

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Parser()` | Create a parser with the defualt priority set to -1.
    `Parser​(int defaultPriority)` | Create a parser with a default priority.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `init​(org.apache.axiom.om.OMElement conditions)` | Build the parser from a given XML
    `int` | `parse​(EvaluatorContext context)` | Parse the HTTP request against the condition set and return the matching priority.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Parser

          public Parser()

      Create a parser with the defualt priority set to -1. If a HTTP message doesn't obey any of the conditions parser will return -1.

    - #### Parser

          public Parser​(int defaultPriority)

      Create a parser with a default priority. If none of the rules matches the given HTTP request, it returns the default priority.
      Parameters:
        `defaultPriority` - default priority

  - ### Method Detail

    - #### parse

          public int parse​(EvaluatorContext context)

      Parse the HTTP request against the condition set and return the matching priority.
      Parameters:
        `context` - context used for holding the HTTP information
      Returns:
        priority as an integer

    - #### init

          public void init​(org.apache.axiom.om.OMElement conditions)
                    throws EvaluatorException

      Build the parser from a given XML
      Parameters:
        `conditions` - set of conditions
      Throws:
        `EvaluatorException` - if the configuration is invalid