Interface HttpChannel.Listener

All Superinterfaces:
EventListener
All Known Implementing Classes:
HttpChannel.TransientListeners, HttpChannelListeners
Enclosing class:
HttpChannel

public static interface HttpChannel.Listener extends EventListener

Listener for HttpChannel events.

HttpChannel will emit events for the various phases it goes through while processing an HTTP request and response.

Implementations of this interface may listen to those events to track timing and/or other values such as request URI, etc.

The events parameters, especially the Request object, may be in a transient state depending on the event, and not all properties/features of the parameters may be available inside a listener method.

It is recommended that the event parameters are not acted upon in the listener methods, or undefined behavior may result. For example, it would be a bad idea to try to read some content from the ServletInputStream in listener methods. On the other hand, it is legit to store request attributes in one listener method that may be possibly retrieved in another listener method in a later event.

Listener methods are invoked synchronously from the thread that is performing the request processing, and they should not call blocking code (otherwise the request processing will be blocked as well).

Listener instances that are set as a bean on the Connector are efficiently added to HttpChannel. If additional listeners are added using the deprecated HttpChannel.addListener(Listener)

method, then an instance of HttpChannel.TransientListeners must be added to the connector in order for them to be invoked.