Tomcat Valves are nothing but filters at the container level.
Conventional servlet filters are at request specific whereas Tomcat Valves will act as filters for the whole container instead of a specific requests.
OOTB Implementation CrawlerSessionManagerValve :
1. It identifies whether the request comes from Bots/Crawlers or from legitimate users.
2. If the request is from bots :
- Store the session ID in a Map and use the same session ID for all the requests from the same Bot/Crawler.
- Key: request.getHost() + request.getContext() + clientIp
- Value: Session ID
3. This way we can reduce the number of sessions created by Bots. Otherwise, a huge number of requests from Bots will create too many session objects which are not desirable.
Overriding OOTB Tomcat Valves or Create Custom Tomcat Valve :
Please refer to this link: https://stackoverflow.com/questions/6573325/implementing-tomcat-custom-valve
No comments:
Post a Comment