Class JuneauRestServletContainerInitializer
- All Implemented Interfaces:
jakarta.servlet.ServletContainerInitializer
ServletContainerInitializer that auto-mounts RestServlet
subclasses at their self-declared top-level paths in non-Spring (e.g. web.xml / external
WAR) deployments.
Discovered by the container via META-INF/services/jakarta.servlet.ServletContainerInitializer
and (through @HandlesTypes(RestServlet.class)) handed every concrete
RestServlet on the webapp classpath. It mirrors the Jetty-microservice and Spring Boot
auto-registration mechanisms: the mount paths are read from the top-level chain
(@Rest(paths) / getPaths()) via
RestContext.resolveTopLevelPaths(...) — not path() (child-composition).
Activation:
Opt-in via the context init parameter juneau.rest.auto-register=true (parity with the
Spring Boot juneau.rest.auto-register property). When unset or not true, the
initializer does nothing, so it never collides with servlets the deployer declared manually in
web.xml. Declare it in web.xml:
Behavior:
For each handled class that is concrete, carries a @Rest annotation, is no-arg
instantiable, and resolves to at least one top-level path, an instance is created and added to the
servlet context at each resolved path. Classes that resolve to no top-level paths (pure mixins /
child-composed resources) or that cannot be instantiated with a no-arg constructor are skipped.
See Also:
- Since:
- 10.0.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringContext init parameter that opts a webapp into auto-registration. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
AUTO_REGISTER_PARAM
Context init parameter that opts a webapp into auto-registration.- See Also:
-
-
Constructor Details
-
JuneauRestServletContainerInitializer
-
-
Method Details