public class RobotDecoratorMapper extends AbstractDecoratorMapper
The name of this decorator should be supplied in the decorator
property.
DecoratorMapper
Modifier and Type | Field and Description |
---|---|
private static java.lang.String[] |
botAgents
All known robot user-agent headers (list can be found
here).
|
private static java.lang.String[] |
botHosts
All known robot hosts (list can be found here).
|
private java.lang.String |
decoratorName |
config, parent
Constructor and Description |
---|
RobotDecoratorMapper() |
Modifier and Type | Method and Description |
---|---|
Decorator |
getDecorator(javax.servlet.http.HttpServletRequest request,
Page page)
Delegate to parent.
|
void |
init(Config config,
java.util.Properties properties,
DecoratorMapper parent)
Set parent.
|
private static boolean |
isBot(javax.servlet.http.HttpServletRequest request)
Check if the current request came from a robot (also known as spider, crawler, ferret)
|
getNamedDecorator
private java.lang.String decoratorName
private static final java.lang.String[] botHosts
private static final java.lang.String[] botAgents
NOTE: To avoid bad detection:
public void init(Config config, java.util.Properties properties, DecoratorMapper parent) throws java.lang.InstantiationException
AbstractDecoratorMapper
init
in interface DecoratorMapper
init
in class AbstractDecoratorMapper
config
- Config supplied by Servlet or Filter.properties
- Any initialization properties (specific to implementation).java.lang.InstantiationException
- should be thrown if the implementation
cannot be initialized properly.public Decorator getDecorator(javax.servlet.http.HttpServletRequest request, Page page)
AbstractDecoratorMapper
getDecorator
in interface DecoratorMapper
getDecorator
in class AbstractDecoratorMapper
private static boolean isBot(javax.servlet.http.HttpServletRequest request)