Class BotRuleParser
java.lang.Object
org.frontcache.bots.BotRuleParser
Parses one line of conf/bots.conf.
Two line shapes, and the absence of a top-level
| is what tells them apart:
Googlebot bare User-Agent keyword (pre-2.9.0 format) fake-googlebot | ua~(?i)googlebot ; !client-ip:@googlebot-ips.txt | bot | dry-runThe rule form is the guard-rules.conf grammar with an action field that holds a client type instead of an action - so the field splitter (
GuardRuleParser.splitFields(String)) and the
predicate factory are the guard ones, in GuardPredicateFactory.Scope.BOTS scope. Sharing
them is the point: an operator writes one syntax, and a fix to either reaches both files.
Every rejection is a GuardConfigException so the caller can skip that single line and
keep the rest of the file working.-
Method Summary
-
Method Details
-
parse
- Parameters:
line- one non-blank, non-comment line- Returns:
- the compiled rule
- Throws:
GuardConfigException- when the line cannot be used
-
keywordRule
A bare line: the pre-2.9.0 format, one User-Agent substring per line, still supported and still how most of a bots.conf is written. The keyword becomes the rule name, so the console shows which keyword matched and its hit counter says whether it is earning its place in the file.
-