@Contract @ConstrainedTo(value=SERVER) public interface ApplicationEventListener
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).Modifier and Type | Method and Description |
---|---|
void |
onEvent(ApplicationEvent event)
Process the application
event . |
RequestEventListener |
onRequest(RequestEvent requestEvent)
Process a new request and return a
request event listener if
listening to request events is required. |
void onEvent(ApplicationEvent event)
event
. This method is called when new event occurs.event
- Application event.RequestEventListener onRequest(RequestEvent requestEvent)
request event listener
if
listening to 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.Type.START
.requestEvent
; null otherwise.Copyright © 2007-2021, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.