Class Parser
java.lang.Object
org.apache.synapse.commons.evaluators.Parser
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 -
Method Summary
Modifier and TypeMethodDescriptionvoidinit(org.apache.axiom.om.OMElement conditions) Build the parser from a given XMLintparse(EvaluatorContext context) Parse the HTTP request against the condition set and return the matching priority.
-
Constructor Details
-
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 Details
-
parse
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
Build the parser from a given XML- Parameters:
conditions- set of conditions- Throws:
EvaluatorException- if the configuration is invalid
-