@Contract @ConstrainedTo(value=SERVER) public interface ApplicationEventListener
The implementation of this interface will be called for two kind of events:
application events and
request events. This interface will listen to
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
or by returning from
Application.getSingletons()}. The provider can be registered only on the server
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).
void onEvent(ApplicationEvent event)
event. This method is called when new event occurs.
event - Application event.
RequestEventListener onRequest(RequestEvent requestEvent)
request event listener if
request 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 then
null must be returned
from the method (do not return empty mock listener in these
cases as it will have negative performance impact).
requestEvent - Event of type
requestEvent; null otherwise.
Copyright © 2007-2021, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.