public class WebListenerInstaller extends InstallerOptionsSupport implements FeatureInstaller<java.util.EventListener>, InstanceInstaller<java.util.EventListener>, Ordered
WebListener (servlet api annotation).
Such listeners will not be installed by jetty because dropwizard didn't depend on jetty-annotations.
As stated in WebListener annotation javadoc both servlet (4) and session events (3) supported. But
dropwizard by default is stateless, so http listeners will be installed only if session handler defined.
Single extension could implement multiple listener interfaces (even all of them).
IMPORTANT: For session listeners registered for context without sessions support enabled only warning will
be showed in logs (and listeners will not be installed). Error is not thrown to let writing more universal
bundles with listener extensions (session related extensions will simply not work).
Use InstallersOptions.DenySessionListenersWithoutSession
to throw exception instead of warning.
By default, everything is installed for main context. Special annotation
AdminContext must be used to install into admin
or both contexts.
Reporting format:
[context markers: M - main, A - admin] (class). If listener registered only in main context, then context marker (M) is not shown.
| Constructor and Description |
|---|
WebListenerInstaller() |
| Modifier and Type | Method and Description |
|---|---|
void |
install(io.dropwizard.setup.Environment environment,
java.util.EventListener instance)
Use
FeatureUtils.getInstanceClass(instance) to overcome proxies and get correct type. |
boolean |
matches(java.lang.Class<?> type)
NOTE: consider using
ru.vyarus.dropwizard.guice.module.installer.util.FeatureUtils to simplify checks
(for example, types most likely must be checks to be not abstract). |
void |
report()
Called to log registered endpoints in dropwizard log fashion.
|
option, setOptionspublic boolean matches(java.lang.Class<?> type)
FeatureInstallerru.vyarus.dropwizard.guice.module.installer.util.FeatureUtils to simplify checks
(for example, types most likely must be checks to be not abstract).
When type accepted by any extension it's registered in guice module.
matches in interface FeatureInstaller<java.util.EventListener>type - type to checkpublic void install(io.dropwizard.setup.Environment environment,
java.util.EventListener instance)
InstanceInstallerFeatureUtils.getInstanceClass(instance) to overcome proxies and get correct type.install in interface InstanceInstaller<java.util.EventListener>environment - environment objectinstance - extension instancepublic void report()
FeatureInstallerReporter to simplify reporting.
Method may do nothing if reporting not required
report in interface FeatureInstaller<java.util.EventListener>