Class ServletManager
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.beans.factory.InitializingBean
,org.springframework.context.ApplicationContextAware
,org.springframework.web.context.ServletContextAware
Enables the use of programmatically adding servlets to the given ServletContext.
Run during the ApplicationServers contextInitialized
phase, before starting servlets.
This ensures that all (dynamic) servlets
are created, before servlets are being created.
This in turn avoids a ConcurrentModificationException if this where to be done during a servlet
initialization phase.
When dtap.stage
is set to LOC, the default behavior of each servlet is not-secured (no authentication) on HTTP.
When dtap.stage
is NOT set to LOC, the default behavior of each servlet is secured (authentication enforced) on HTTPS.
To change this behavior the following properties can be used;
servlet.servlet-name.transportGuarantee
- forces HTTPS when set to CONFIDENTIAL, or HTTP when set to NONE
servlet.servlet-name.securityRoles
- use the default IBIS roles or create your own
servlet.servlet-name.urlMapping
- path the servlet listens to
servlet.servlet-name.loadOnStartup
- automatically load or use lazy-loading (affects application startup time)
servlet.servlet-name.authenticator
- enables authentication on this endpoint
- Author:
- Niels Meijer
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
declareRoles
(List<String> roleNames) Register a new rolegetServlet
(String name) protected jakarta.servlet.ServletContext
static jakarta.servlet.annotation.ServletSecurity.TransportGuarantee
getTransportGuarantee
(String propertyName) void
register
(ServletConfiguration config) void
setApplicationContext
(org.springframework.context.ApplicationContext applicationContext) void
setServletContext
(jakarta.servlet.ServletContext servletContext) void
-
Constructor Details
-
ServletManager
public ServletManager()
-
-
Method Details
-
getServletContext
protected jakarta.servlet.ServletContext getServletContext() -
getDeclaredRoles
-
setServletContext
@Autowired @Lazy public void setServletContext(jakarta.servlet.ServletContext servletContext) - Specified by:
setServletContext
in interfaceorg.springframework.web.context.ServletContextAware
-
afterPropertiesSet
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Throws:
Exception
-
startAuthenticators
public void startAuthenticators() -
declareRoles
Register a new role- Parameters:
roleNames
- String or multiple strings of roleNames to register
-
register
-
getServlet
-
getServlets
-
getTransportGuarantee
public static jakarta.servlet.annotation.ServletSecurity.TransportGuarantee getTransportGuarantee(String propertyName) -
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) - Specified by:
setApplicationContext
in interfaceorg.springframework.context.ApplicationContextAware
-