org.apache.catalina.valves
public class CometConnectionManagerValve extends ValveBase implements Lifecycle, javax.servlet.http.HttpSessionListener, LifecycleListener
Implementation of a Valve that tracks Comet connections, and closes them when the associated session expires or the webapp is reloaded.
This Valve should be attached to a Context.
Modifier and Type | Field and Description |
---|---|
protected java.util.List<Request> |
cometRequests
List of current Coment connections.
|
protected java.lang.String |
cometRequestsAttribute
Name of session attribute used to store list of comet connections.
|
protected static java.lang.String |
info
The descriptive information related to this implementation.
|
protected LifecycleSupport |
lifecycle
The lifecycle event support for this component.
|
protected StringManager |
sm
The string manager for this package.
|
protected boolean |
started
Has this component been started yet?
|
container, containerLog, controller, domain, mserver, next, oname
AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, DESTROY_EVENT, INIT_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT
Constructor and Description |
---|
CometConnectionManagerValve() |
Modifier and Type | Method and Description |
---|---|
void |
addLifecycleListener(LifecycleListener listener)
Add a lifecycle event listener to this component.
|
void |
event(Request request,
Response response,
CometEvent event)
Use events to update the connection state.
|
LifecycleListener[] |
findLifecycleListeners()
Get the lifecycle listeners associated with this lifecycle.
|
java.lang.String |
getInfo()
Return descriptive information about this Valve implementation.
|
void |
invoke(Request request,
Response response)
Register requests for tracking, whenever needed.
|
void |
lifecycleEvent(LifecycleEvent event)
Acknowledge the occurrence of the specified event.
|
void |
removeLifecycleListener(LifecycleListener listener)
Remove a lifecycle event listener from this component.
|
void |
sessionCreated(javax.servlet.http.HttpSessionEvent se)
Notification that a session was created.
|
void |
sessionDestroyed(javax.servlet.http.HttpSessionEvent se)
Notification that a session is about to be invalidated.
|
void |
start()
Prepare for the beginning of active use of the public methods of this
component.
|
void |
stop()
Gracefully terminate the active use of the public methods of this
component.
|
backgroundProcess, createObjectName, getContainer, getContainerName, getController, getDomain, getNext, getObjectName, getParentName, postDeregister, postRegister, preDeregister, preRegister, setContainer, setController, setNext, setObjectName, toString
protected static final java.lang.String info
protected StringManager sm
protected LifecycleSupport lifecycle
protected boolean started
protected java.util.List<Request> cometRequests
protected java.lang.String cometRequestsAttribute
public void addLifecycleListener(LifecycleListener listener)
addLifecycleListener
in interface Lifecycle
listener
- The listener to addpublic LifecycleListener[] findLifecycleListeners()
findLifecycleListeners
in interface Lifecycle
public void removeLifecycleListener(LifecycleListener listener)
removeLifecycleListener
in interface Lifecycle
listener
- The listener to addpublic void start() throws LifecycleException
configure()
,
and before any of the public methods of the component are utilized.start
in interface Lifecycle
LifecycleException
- if this component detects a fatal error
that prevents this component from being usedpublic void stop() throws LifecycleException
stop
in interface Lifecycle
LifecycleException
- if this component detects a fatal error
that needs to be reportedpublic void lifecycleEvent(LifecycleEvent event)
LifecycleListener
lifecycleEvent
in interface LifecycleListener
event
- LifecycleEvent that has occurredpublic java.lang.String getInfo()
public void invoke(Request request, Response response) throws java.io.IOException, javax.servlet.ServletException
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 occursjavax.servlet.ServletException
- if a servlet error occurspublic void event(Request request, Response response, CometEvent event) throws java.io.IOException, javax.servlet.ServletException
public void sessionCreated(javax.servlet.http.HttpSessionEvent se)
javax.servlet.http.HttpSessionListener
sessionCreated
in interface javax.servlet.http.HttpSessionListener
se
- the notification eventpublic void sessionDestroyed(javax.servlet.http.HttpSessionEvent se)
javax.servlet.http.HttpSessionListener
sessionDestroyed
in interface javax.servlet.http.HttpSessionListener
se
- the notification eventCopyright © 2000-2014 Apache Software Foundation. All Rights Reserved.