Package org.microproxy.extras
Class ModifyBody.Rule
java.lang.Object
org.microproxy.extras.ModifyBody.Rule
- Enclosing class:
ModifyBody
One rule: a regular expression to replace in the bodies a filter selects.
-
Method Summary
Modifier and TypeMethodDescriptionfilter()Returns the messages this rule edits.static ModifyBody.Ruleof(FlowFilter filter, String regex, String replacement) A rule that replacesregexwith the literalreplacement.static ModifyBody.RuleParses a spec of the form[|flow-filter]|regex|[@]replacement.pattern()Returns the regular expression, over the body's bytes as ISO-8859-1 characters.
-
Method Details
-
of
A rule that replacesregexwith the literalreplacement.- Parameters:
filter- the messages to editregex- the regular expression, matched against the decoded body's bytesreplacement- the replacement text, inserted as UTF-8- Returns:
- the rule
- Throws:
IllegalArgumentException- if the regular expression is invalid
-
parse
Parses a spec of the form[|flow-filter]|regex|[@]replacement.- Parameters:
spec- the spec, starting with its separator- Returns:
- the rule
- Throws:
IllegalArgumentException- if the spec is invalid or its file cannot be read
-
filter
Returns the messages this rule edits.- Returns:
- the messages this rule edits
-
pattern
Returns the regular expression, over the body's bytes as ISO-8859-1 characters.- Returns:
- the regular expression, over the body's bytes as ISO-8859-1 characters
-