Class WebListenerInstaller
- All Implemented Interfaces:
FeatureInstaller,InstanceInstaller<EventListener>,WebInstaller,WithOptions,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.
- Since:
- 06.08.2016
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionMethod used by extensions help report (GuiceBundle.Builder.printExtensionsHelp()) to show what signs this exact installer recognize so user could better understand extensions support specifics.voidinstall(io.dropwizard.core.setup.Environment environment, EventListener instance) UseFeatureUtils.getInstanceClass(instance)to overcome proxies and get correct type.booleanNOTE: consider usingru.vyarus.dropwizard.guice.module.installer.util.FeatureUtilsto simplify checks (for example, types most likely must be checks to be not abstract).voidreport()Called to log registered endpoints in dropwizard log fashion.Methods inherited from class ru.vyarus.dropwizard.guice.module.installer.option.InstallerOptionsSupport
option, setOptions
-
Constructor Details
-
WebListenerInstaller
public WebListenerInstaller()
-
-
Method Details
-
matches
Description copied from interface:FeatureInstallerNOTE: consider usingru.vyarus.dropwizard.guice.module.installer.util.FeatureUtilsto 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.
- Specified by:
matchesin interfaceFeatureInstaller- Parameters:
type- type to check- Returns:
- true if extension recognized, false otherwise
-
install
Description copied from interface:InstanceInstallerUseFeatureUtils.getInstanceClass(instance)to overcome proxies and get correct type.Full
Injectorcould be obtained withInjectorLookup.getInjector(Environment).Shared state could be obtained with
SharedConfigurationState.get(Environment)- Specified by:
installin interfaceInstanceInstaller<EventListener>- Parameters:
environment- environment objectinstance- extension instance
-
report
public void report()Description copied from interface:FeatureInstallerCalled to log registered endpoints in dropwizard log fashion. It's important to naturally show all dynamically resolved classes to easily catch errors. UseReporterto simplify reporting.Method may do nothing if reporting not required
- Specified by:
reportin interfaceFeatureInstaller
-
getRecognizableSigns
Description copied from interface:FeatureInstallerMethod used by extensions help report (GuiceBundle.Builder.printExtensionsHelp()) to show what signs this exact installer recognize so user could better understand extensions support specifics.- Specified by:
getRecognizableSignsin interfaceFeatureInstaller- Returns:
- list of extension signs installer recognize
-