org.apache.catalina.valves

Class CometConnectionManagerValve

public class CometConnectionManagerValve extends ValveBase implements Lifecycle, 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.

Version: $Revision: 769328 $ $Date: 2009-04-28 12:39:24 +0200 (Tue, 28 Apr 2009) $

Author: Remy Maucherat

Field Summary
protected List<Request>cometRequests
List of current Coment connections.
protected StringcometRequestsAttribute
Name of session attribute used to store list of comet connections.
protected static Stringinfo
The descriptive information related to this implementation.
protected LifecycleSupportlifecycle
The lifecycle event support for this component.
protected StringManagersm
The string manager for this package.
protected booleanstarted
Has this component been started yet?
Method Summary
voidaddLifecycleListener(LifecycleListener listener)
Add a lifecycle event listener to this component.
voidevent(Request request, Response response, CometEvent event)
Use events to update the connection state.
LifecycleListener[]findLifecycleListeners()
Get the lifecycle listeners associated with this lifecycle.
StringgetInfo()
Return descriptive information about this Valve implementation.
voidinvoke(Request request, Response response)
Register requests for tracking, whenever needed.
voidlifecycleEvent(LifecycleEvent event)
voidremoveLifecycleListener(LifecycleListener listener)
Remove a lifecycle event listener from this component.
voidsessionCreated(HttpSessionEvent se)
voidsessionDestroyed(HttpSessionEvent se)
voidstart()
Prepare for the beginning of active use of the public methods of this component.
voidstop()
Gracefully terminate the active use of the public methods of this component.

Field Detail

cometRequests

protected List<Request> cometRequests
List of current Coment connections.

cometRequestsAttribute

protected String cometRequestsAttribute
Name of session attribute used to store list of comet connections.

info

protected static final String info
The descriptive information related to this implementation.

lifecycle

protected LifecycleSupport lifecycle
The lifecycle event support for this component.

sm

protected StringManager sm
The string manager for this package.

started

protected boolean started
Has this component been started yet?

Method Detail

addLifecycleListener

public void addLifecycleListener(LifecycleListener listener)
Add a lifecycle event listener to this component.

Parameters: listener The listener to add

event

public void event(Request request, Response response, CometEvent event)
Use events to update the connection state.

Parameters: request The servlet request to be processed response The servlet response to be created

Throws: IOException if an input/output error occurs ServletException if a servlet error occurs

findLifecycleListeners

public LifecycleListener[] findLifecycleListeners()
Get the lifecycle listeners associated with this lifecycle. If this Lifecycle has no listeners registered, a zero-length array is returned.

getInfo

public String getInfo()
Return descriptive information about this Valve implementation.

invoke

public void invoke(Request request, Response response)
Register requests for tracking, whenever needed.

Parameters: request The servlet request to be processed response The servlet response to be created

Throws: IOException if an input/output error occurs ServletException if a servlet error occurs

lifecycleEvent

public void lifecycleEvent(LifecycleEvent event)

removeLifecycleListener

public void removeLifecycleListener(LifecycleListener listener)
Remove a lifecycle event listener from this component.

Parameters: listener The listener to add

sessionCreated

public void sessionCreated(HttpSessionEvent se)

sessionDestroyed

public void sessionDestroyed(HttpSessionEvent se)

start

public void start()
Prepare for the beginning of active use of the public methods of this component. This method should be called after configure(), and before any of the public methods of the component are utilized.

Throws: LifecycleException if this component detects a fatal error that prevents this component from being used

stop

public void stop()
Gracefully terminate the active use of the public methods of this component. This method should be the last one called on a given instance of this component.

Throws: LifecycleException if this component detects a fatal error that needs to be reported

Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.