Interface ApplicationEventListener
- All Known Implementing Classes:
ApplicationInfoListener
,CompositeApplicationEventListener
,MetricsApplicationEventListener
,MonitoringEventListener
,ObservationApplicationEventListener
Jersey specific provider that listens to
application events
.
The implementation of this interface will be called for two kind of events:
application events and request events
. This interface will listen to
all application event types
but only to first request event which is the RequestEvent.Type.START
. On this event the
application event listener can decide whether it will listen to the request and return request event listener
for listening to further request events.
}
The implementation of this interface can be registered as a standard Jersey/JAX-RS provider
by annotating with @Provider
annotation in the case of
class path scanning, by registering as a provider using ResourceConfig
or by returning from Application.getClasses()
or Application.getSingletons()
}. The provider can be registered only on the server
side.
Application event listener can read data of events but must not modify them in any way. The implementation
must be thread safe (the methods might be called from different threads).- Author:
- Miroslav Fuksa
-
Method Summary
Modifier and TypeMethodDescriptionvoid
onEvent
(ApplicationEvent event) Process the applicationevent
.onRequest
(RequestEvent requestEvent) Process a new request and return arequest event listener
if listening torequest events
is required.
-
Method Details
-
onEvent
Process the applicationevent
. This method is called when new event occurs.- Parameters:
event
- Application event.
-
onRequest
Process a new request and return arequest event listener
if listening torequest events
is required. The method is called once for each new incoming request. If listening to the request is required then request event must be returned from the method. Such a request event listener will receive all request events that one request. If listening to request event for the request is not required thennull
must be returned from the method (do not return empty mock listener in these cases as it will have negative performance impact).- Parameters:
requestEvent
- Event of typeRequestEvent.Type.START
.- Returns:
- Request event listener that will monitor the events of the request
connected with
requestEvent
; null otherwise.
-