public class WebServletInstaller extends InstallerOptionsSupport implements FeatureInstaller<javax.servlet.http.HttpServlet>, InstanceInstaller<javax.servlet.http.HttpServlet>, Ordered
WebServlet (servlet api annotation). Such servlets will not
be installed by jetty because dropwizard didn't depend on jetty-annotations.
Only the following WebServlet annotation properties are supported: name, urlPatterns ( or value),
initParams, asyncSupported.
When servlet name not defined, then name will be generated as: . (dot) at the beginning to indicate generated name, followed by lower-cased class name. If class ends with "servlet" then it will be cut off. For example, for class "MyCoolServlet" generated name will be ".mycool".
If servlet mapping clash (partially or completely) with some other servlet then warning log will be printed,
but overall process will not fail. Use
InstallersOptions.DenyServletRegistrationWithClash 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:
[urls] [context markers: M - main, A - admin] (class) [servlet name]. If servlet registered only in main context, then context marker (M) is not shown.
| Constructor and Description |
|---|
WebServletInstaller() |
| Modifier and Type | Method and Description |
|---|---|
void |
install(io.dropwizard.setup.Environment environment,
javax.servlet.http.HttpServlet 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<javax.servlet.http.HttpServlet>type - type to checkpublic void install(io.dropwizard.setup.Environment environment,
javax.servlet.http.HttpServlet instance)
InstanceInstallerFeatureUtils.getInstanceClass(instance) to overcome proxies and get correct type.install in interface InstanceInstaller<javax.servlet.http.HttpServlet>environment - environment objectinstance - extension instancepublic void report()
FeatureInstallerReporter to simplify reporting.
Method may do nothing if reporting not required
report in interface FeatureInstaller<javax.servlet.http.HttpServlet>