public class CrawlerSessionManagerValve extends ValveBase implements HttpSessionBindingListener
Lifecycle.SingleUse
asyncSupported, container, containerLog, next, sm
mserver
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 and Description |
---|
CrawlerSessionManagerValve()
Specifies a default constructor so async support can be configured.
|
Modifier and Type | Method and Description |
---|---|
java.util.Map<java.lang.String,java.lang.String> |
getClientIpSessionId() |
java.lang.String |
getCrawlerIps() |
java.lang.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.
|
boolean |
isContextAware() |
boolean |
isHostAware() |
void |
setContextAware(boolean isContextAware) |
void |
setCrawlerIps(java.lang.String crawlerIps)
Specify the regular expression (using
Pattern ) that will be used
to identify crawlers based on their IP address. |
void |
setCrawlerUserAgents(java.lang.String crawlerUserAgents)
Specify the regular expression (using
Pattern ) that will be used
to identify crawlers based in the User-Agent header provided. |
void |
setHostAware(boolean isHostAware) |
void |
setSessionInactiveInterval(int sessionInactiveInterval)
Specify the session timeout (in seconds) for a crawler's session.
|
void |
valueBound(HttpSessionBindingEvent event)
Notifies the object that it is being bound to a session and identifies
the session.
|
void |
valueUnbound(HttpSessionBindingEvent event)
Notifies the object that it is being unbound from a session and
identifies the session.
|
backgroundProcess, event, getContainer, getDomainInternal, getNext, getObjectNameKeyProperties, isAsyncSupported, setAsyncSupported, setContainer, setNext, startInternal, stopInternal, toString
destroyInternal, getDomain, getObjectName, postDeregister, postRegister, preDeregister, preRegister, register, setDomain, unregister
addLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, init, removeLifecycleListener, setState, setState, start, stop
public CrawlerSessionManagerValve()
public void setCrawlerUserAgents(java.lang.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 java.lang.String getCrawlerUserAgents()
setCrawlerUserAgents(String)
public void setCrawlerIps(java.lang.String crawlerIps)
Pattern
) that will be used
to identify crawlers based on their IP address. The default is no crawler
IPs.crawlerIps
- The regular expression using Pattern
public java.lang.String getCrawlerIps()
setCrawlerIps(String)
public void setSessionInactiveInterval(int sessionInactiveInterval)
sessionInactiveInterval
- The new timeout for crawler sessionspublic int getSessionInactiveInterval()
setSessionInactiveInterval(int)
public java.util.Map<java.lang.String,java.lang.String> getClientIpSessionId()
public boolean isHostAware()
public void setHostAware(boolean isHostAware)
public boolean isContextAware()
public void setContextAware(boolean isContextAware)
protected void initInternal() throws LifecycleException
LifecycleMBeanBase
initInternal
in class ValveBase
LifecycleException
public void invoke(Request request, Response response) throws java.io.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 createdjava.io.IOException
- if an input/output error occursServletException
- if a servlet error occurspublic void valueBound(HttpSessionBindingEvent event)
javax.servlet.http.HttpSessionBindingListener
valueBound
in interface HttpSessionBindingListener
event
- the event that identifies the sessionHttpSessionBindingListener.valueUnbound(javax.servlet.http.HttpSessionBindingEvent)
public void valueUnbound(HttpSessionBindingEvent event)
javax.servlet.http.HttpSessionBindingListener
valueUnbound
in interface HttpSessionBindingListener
event
- the event that identifies the sessionHttpSessionBindingListener.valueBound(javax.servlet.http.HttpSessionBindingEvent)
Copyright © 2000-2018 Apache Software Foundation. All Rights Reserved.