|
Apache Tomcat 7.0.16 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.catalina.util.LifecycleBase
org.apache.catalina.util.LifecycleMBeanBase
org.apache.catalina.valves.ValveBase
org.apache.catalina.valves.CrawlerSessionManagerValve
public class CrawlerSessionManagerValve
Web crawlers can trigger the creation of many thousands of sessions as they crawl a site which may result in significant memory consumption. This Valve ensures that crawlers are associated with a single session - just like normal users - regardless of whether or not they provide a session token with their requests.
Field Summary |
---|
Fields inherited from class org.apache.catalina.valves.ValveBase |
---|
asyncSupported, container, containerLog, info, next, sm |
Fields inherited from class org.apache.catalina.util.LifecycleMBeanBase |
---|
mserver |
Fields inherited from interface org.apache.catalina.Lifecycle |
---|
AFTER_DESTROY_EVENT, AFTER_INIT_EVENT, AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_DESTROY_EVENT, BEFORE_INIT_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, CONFIGURE_START_EVENT, CONFIGURE_STOP_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT |
Constructor Summary | |
---|---|
CrawlerSessionManagerValve()
Specifies a default constructor so async support can be configured. |
Method Summary | |
---|---|
void |
backgroundProcess()
Execute a periodic task, such as reloading, etc. |
String |
getCrawlerUserAgents()
|
int |
getSessionInactiveInterval()
|
protected void |
initInternal()
Sub-classes wishing to perform additional initialization should override this method, ensuring that super.initInternal() is the first call in the overriding method. |
void |
invoke(Request request,
Response response)
The implementation-specific logic represented by this Valve. |
void |
setCrawlerUserAgents(String crawlerUserAgents)
Specify the regular expression (using Pattern ) that will be used
to identify crawlers based in the User-Agent header provided. |
void |
setSessionInactiveInterval(int sessionInactiveInterval)
Specify the session timeout (in seconds) for a crawler's session. |
Methods inherited from class org.apache.catalina.valves.ValveBase |
---|
event, getContainer, getDomainInternal, getInfo, getNext, getObjectNameKeyProperties, isAsyncSupported, setAsyncSupported, setContainer, setNext, startInternal, stopInternal, toString |
Methods inherited from class org.apache.catalina.util.LifecycleMBeanBase |
---|
destroyInternal, getDomain, getObjectName, postDeregister, postRegister, preDeregister, preRegister, register, setDomain, unregister |
Methods inherited from class org.apache.catalina.util.LifecycleBase |
---|
addLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, init, removeLifecycleListener, setState, setState, start, stop |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CrawlerSessionManagerValve()
Method Detail |
---|
public void setCrawlerUserAgents(String crawlerUserAgents)
Pattern
) that will be used
to identify crawlers based in the User-Agent header provided. The default
is ".*GoogleBot.*|.*bingbot.*|.*Yahoo! Slurp.*"
crawlerUserAgents
- The regular expression using Pattern
public String getCrawlerUserAgents()
setCrawlerUserAgents(String)
public void setSessionInactiveInterval(int sessionInactiveInterval)
sessionInactiveInterval
- The new timeout for crawler sessionspublic int getSessionInactiveInterval()
setSessionInactiveInterval(int)
protected void initInternal() throws LifecycleException
LifecycleMBeanBase
initInternal
in class ValveBase
LifecycleException
public void invoke(Request request, Response response) throws IOException, ServletException
ValveBase
This method MUST be provided by a subclass.
invoke
in interface Valve
invoke
in class ValveBase
request
- The servlet request to be processedresponse
- The servlet response to be created
IOException
- if an input/output error occurs
ServletException
- if a servlet error occurspublic void backgroundProcess()
ValveBase
backgroundProcess
in interface Valve
backgroundProcess
in class ValveBase
|
Apache Tomcat 7.0.16 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |