public class PathRule extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static org.slf4j.Logger |
logger |
Pattern |
pattern |
int |
type |
| Constructor and Description |
|---|
PathRule(int type,
String pattern)
Create a new path rule, based on the specified pattern
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
matches(String path)
Check if the specified path matches this rule
|
static boolean |
matchesRobotsPattern(String pattern,
String path)
Check if the specified path matches a robots.txt pattern
|
static Pattern |
robotsPatternToRegexp(String pattern)
Match a pattern defined in a robots.txt file to a path
Following the pattern definition as stated on:
https://support.google.com/webmasters/answer/6062596?hl=en&ref_topic=6061961
This page defines the following items:
* matches any sequence of characters, including /
$ matches the end of the line
|
protected static final org.slf4j.Logger logger
public int type
public Pattern pattern
public PathRule(int type,
String pattern)
type - Either HostDirectives.ALLOWS or HostDirectives.DISALLOWSpattern - The pattern for this rulepublic static Pattern robotsPatternToRegexp(String pattern)
pattern - The pattern to convertpublic static boolean matchesRobotsPattern(String pattern, String path)
pattern - The pattern to matchpath - The path to match with the patternpublic boolean matches(String path)
path - The path to match with this patternCopyright © 2017. All rights reserved.