Interface ApplicationEventListener
-
- All Known Implementing Classes:
ApplicationInfoListener
,CompositeApplicationEventListener
,MonitoringEventListener
@Contract @ConstrainedTo(SERVER) public interface ApplicationEventListener
Jersey specific provider that listens toapplication events
. The implementation of this interface will be called for two kind of events: application events andrequest events
. This interface will listen to allapplication event types
but only to first request event which is theRequestEvent.Type.START
. On this event the application event listener can decide whether it will listen to the request and returnrequest 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 usingResourceConfig
or by returning fromApplication.getClasses()
orApplication.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).
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
onEvent(ApplicationEvent event)
Process the applicationevent
.RequestEventListener
onRequest(RequestEvent requestEvent)
Process a new request and return arequest event listener
if listening torequest events
is required.
-
-
-
Method Detail
-
onEvent
void onEvent(ApplicationEvent event)
Process the applicationevent
. This method is called when new event occurs.- Parameters:
event
- Application event.
-
onRequest
RequestEventListener onRequest(RequestEvent requestEvent)
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.
-
-