Class DeploymentInfo

  • All Implemented Interfaces:
    java.lang.Cloneable

    public class DeploymentInfo
    extends java.lang.Object
    implements java.lang.Cloneable
    Represents a servlet deployment.
    Author:
    Stuart Douglas
    • Constructor Detail

      • DeploymentInfo

        public DeploymentInfo()
    • Method Detail

      • validate

        public void validate()
      • getDeploymentName

        public java.lang.String getDeploymentName()
      • setDeploymentName

        public DeploymentInfo setDeploymentName​(java.lang.String deploymentName)
      • getDisplayName

        public java.lang.String getDisplayName()
      • setDisplayName

        public DeploymentInfo setDisplayName​(java.lang.String displayName)
      • getContextPath

        public java.lang.String getContextPath()
      • setContextPath

        public DeploymentInfo setContextPath​(java.lang.String contextPath)
      • getClassLoader

        public java.lang.ClassLoader getClassLoader()
      • setClassLoader

        public DeploymentInfo setClassLoader​(java.lang.ClassLoader classLoader)
      • getResourceManager

        public io.undertow.server.handlers.resource.ResourceManager getResourceManager()
      • setResourceManager

        public DeploymentInfo setResourceManager​(io.undertow.server.handlers.resource.ResourceManager resourceManager)
      • isAllowNonStandardWrappers

        public boolean isAllowNonStandardWrappers()
      • setAllowNonStandardWrappers

        public DeploymentInfo setAllowNonStandardWrappers​(boolean allowNonStandardWrappers)
      • getDefaultSessionTimeout

        public int getDefaultSessionTimeout()
      • setDefaultSessionTimeout

        public DeploymentInfo setDefaultSessionTimeout​(int defaultSessionTimeout)
        Parameters:
        defaultSessionTimeout - The default session timeout, in seconds
      • getDefaultEncoding

        public java.lang.String getDefaultEncoding()
      • setDefaultEncoding

        public DeploymentInfo setDefaultEncoding​(java.lang.String defaultEncoding)
        Sets the default encoding that will be used for servlet responses
        Parameters:
        defaultEncoding - The default encoding
      • getUrlEncoding

        public java.lang.String getUrlEncoding()
      • setUrlEncoding

        public DeploymentInfo setUrlEncoding​(java.lang.String urlEncoding)
        Sets the URL encoding. This will only take effect if the UndertowOptions.DECODE_URL parameter has been set to false. This allows multiple deployments in the same server to use a different URL encoding
        Parameters:
        urlEncoding - The encoding to use
      • getServlets

        public java.util.Map<java.lang.String,​ServletInfo> getServlets()
      • getFilters

        public java.util.Map<java.lang.String,​FilterInfo> getFilters()
      • addFilterUrlMapping

        public DeploymentInfo addFilterUrlMapping​(java.lang.String filterName,
                                                  java.lang.String mapping,
                                                  jakarta.servlet.DispatcherType dispatcher)
      • addFilterServletNameMapping

        public DeploymentInfo addFilterServletNameMapping​(java.lang.String filterName,
                                                          java.lang.String mapping,
                                                          jakarta.servlet.DispatcherType dispatcher)
      • insertFilterUrlMapping

        public DeploymentInfo insertFilterUrlMapping​(int pos,
                                                     java.lang.String filterName,
                                                     java.lang.String mapping,
                                                     jakarta.servlet.DispatcherType dispatcher)
      • insertFilterServletNameMapping

        public DeploymentInfo insertFilterServletNameMapping​(int pos,
                                                             java.lang.String filterName,
                                                             java.lang.String mapping,
                                                             jakarta.servlet.DispatcherType dispatcher)
      • getListeners

        public java.util.List<ListenerInfo> getListeners()
      • getMajorVersion

        public int getMajorVersion()
      • setMajorVersion

        public DeploymentInfo setMajorVersion​(int majorVersion)
      • getMinorVersion

        public int getMinorVersion()
      • setMinorVersion

        public DeploymentInfo setMinorVersion​(int minorVersion)
      • getThreadSetupActions

        public java.util.List<ThreadSetupHandler> getThreadSetupActions()
      • isEagerFilterInit

        public boolean isEagerFilterInit()
      • setEagerFilterInit

        public DeploymentInfo setEagerFilterInit​(boolean eagerFilterInit)
      • addInitParameter

        public DeploymentInfo addInitParameter​(java.lang.String name,
                                               java.lang.String value)
      • getInitParameters

        public java.util.Map<java.lang.String,​java.lang.String> getInitParameters()
      • addServletContextAttribute

        public DeploymentInfo addServletContextAttribute​(java.lang.String name,
                                                         java.lang.Object value)
      • getServletContextAttributes

        public java.util.Map<java.lang.String,​java.lang.Object> getServletContextAttributes()
      • addWelcomePage

        public DeploymentInfo addWelcomePage​(java.lang.String welcomePage)
      • addWelcomePages

        public DeploymentInfo addWelcomePages​(java.lang.String... welcomePages)
      • addWelcomePages

        public DeploymentInfo addWelcomePages​(java.util.Collection<java.lang.String> welcomePages)
      • getWelcomePages

        public java.util.List<java.lang.String> getWelcomePages()
      • getErrorPages

        public java.util.List<ErrorPage> getErrorPages()
      • getMimeMappings

        public java.util.List<MimeMapping> getMimeMappings()
      • getSecurityConstraints

        public java.util.List<SecurityConstraint> getSecurityConstraints()
      • getExecutor

        public java.util.concurrent.Executor getExecutor()
      • setExecutor

        public DeploymentInfo setExecutor​(java.util.concurrent.Executor executor)
        Sets the executor that will be used to run servlet invocations. If this is null then the XNIO worker pool will be used.

        Individual servlets may use a different executor

        If this is null then the current executor is used, which is generally the XNIO worker pool

        Parameters:
        executor - The executor
        See Also:
        ServletInfo.executor
      • getAsyncExecutor

        public java.util.concurrent.Executor getAsyncExecutor()
      • setAsyncExecutor

        public DeploymentInfo setAsyncExecutor​(java.util.concurrent.Executor asyncExecutor)
        Sets the executor that is used to run async tasks.

        If this is null then executor is used, if this is also null then the default is used

        Parameters:
        asyncExecutor - The executor
      • getTempDir

        public java.io.File getTempDir()
      • getTempPath

        public java.nio.file.Path getTempPath()
      • requireTempPath

        public java.nio.file.Path requireTempPath()
        Returns:
        Returns the temp directory path if it's not null, else returns the system level temporary directory path pointed to by the Java system property java.io.tmpdir
      • setTempDir

        public DeploymentInfo setTempDir​(java.io.File tempDir)
      • setTempDir

        public DeploymentInfo setTempDir​(java.nio.file.Path tempDir)
      • isIgnoreFlush

        public boolean isIgnoreFlush()
      • setIgnoreFlush

        public DeploymentInfo setIgnoreFlush​(boolean ignoreFlush)
      • getJspConfigDescriptor

        public jakarta.servlet.descriptor.JspConfigDescriptor getJspConfigDescriptor()
      • setJspConfigDescriptor

        public DeploymentInfo setJspConfigDescriptor​(jakarta.servlet.descriptor.JspConfigDescriptor jspConfigDescriptor)
      • addLocaleCharsetMapping

        public DeploymentInfo addLocaleCharsetMapping​(java.lang.String locale,
                                                      java.lang.String charset)
      • getLocaleCharsetMapping

        public java.util.Map<java.lang.String,​java.lang.String> getLocaleCharsetMapping()
      • getIdentityManager

        public io.undertow.security.idm.IdentityManager getIdentityManager()
      • setIdentityManager

        public DeploymentInfo setIdentityManager​(io.undertow.security.idm.IdentityManager identityManager)
      • addSecurityRole

        public DeploymentInfo addSecurityRole​(java.lang.String role)
      • addSecurityRoles

        public DeploymentInfo addSecurityRoles​(java.lang.String... roles)
      • addSecurityRoles

        public DeploymentInfo addSecurityRoles​(java.util.Collection<java.lang.String> roles)
      • getSecurityRoles

        public java.util.Set<java.lang.String> getSecurityRoles()
      • addOuterHandlerChainWrapper

        public DeploymentInfo addOuterHandlerChainWrapper​(io.undertow.server.HandlerWrapper wrapper)
        Adds an outer handler wrapper. This handler will be run after the servlet initial handler, but before any other handlers. These are only run on REQUEST invocations, they are not invoked on a FORWARD or INCLUDE.
        Parameters:
        wrapper - The wrapper
      • getOuterHandlerChainWrappers

        public java.util.List<io.undertow.server.HandlerWrapper> getOuterHandlerChainWrappers()
      • addInnerHandlerChainWrapper

        public DeploymentInfo addInnerHandlerChainWrapper​(io.undertow.server.HandlerWrapper wrapper)
        Adds an inner handler chain wrapper. This handler will be run after the security handler, but before any other servlet handlers, and will be run for every request
        Parameters:
        wrapper - The wrapper
      • getInnerHandlerChainWrappers

        public java.util.List<io.undertow.server.HandlerWrapper> getInnerHandlerChainWrappers()
      • addInitialHandlerChainWrapper

        public DeploymentInfo addInitialHandlerChainWrapper​(io.undertow.server.HandlerWrapper wrapper)
      • getInitialHandlerChainWrappers

        public java.util.List<io.undertow.server.HandlerWrapper> getInitialHandlerChainWrappers()
      • setInitialSecurityWrapper

        public DeploymentInfo setInitialSecurityWrapper​(io.undertow.server.HandlerWrapper wrapper)
        Sets the initial handler wrapper that will take over responsibility for establishing a security context that will handle authentication for the request. Undertow specific authentication mechanisms will not be installed but Undertow handlers will still make the decision as to if authentication is required and will subsequently call SecurityContext.authenticate() as required.
        Parameters:
        wrapper - the HandlerWrapper to handle the initial security context installation.
        Returns:
        this to allow chaining.
      • getInitialSecurityWrapper

        public io.undertow.server.HandlerWrapper getInitialSecurityWrapper()
      • addSecurityWrapper

        public DeploymentInfo addSecurityWrapper​(io.undertow.server.HandlerWrapper wrapper)
        Adds a security handler. These are invoked before the authentication mechanism, and are always invoked even if authentication is not required.
        Parameters:
        wrapper -
        Returns:
      • getSecurityWrappers

        public java.util.List<io.undertow.server.HandlerWrapper> getSecurityWrappers()
      • addNotificationReceiver

        public DeploymentInfo addNotificationReceiver​(io.undertow.security.api.NotificationReceiver notificationReceiver)
      • addNotificactionReceivers

        public DeploymentInfo addNotificactionReceivers​(io.undertow.security.api.NotificationReceiver... notificationReceivers)
      • addNotificationReceivers

        public DeploymentInfo addNotificationReceivers​(java.util.Collection<io.undertow.security.api.NotificationReceiver> notificationReceivers)
      • getNotificationReceivers

        public java.util.List<io.undertow.security.api.NotificationReceiver> getNotificationReceivers()
      • getServletContextAttributeBackingMap

        public java.util.concurrent.ConcurrentMap<java.lang.String,​java.lang.Object> getServletContextAttributeBackingMap()
      • setServletContextAttributeBackingMap

        public DeploymentInfo setServletContextAttributeBackingMap​(java.util.concurrent.ConcurrentMap<java.lang.String,​java.lang.Object> servletContextAttributeBackingMap)
        Sets the map that will be used by the ServletContext implementation to store attributes.

        This should usuablly be null, in which case Undertow will create a new map. This is only used in situations where you want multiple deployments to share the same servlet context attributes.

        Parameters:
        servletContextAttributeBackingMap - The backing map
      • getHostName

        public java.lang.String getHostName()
        Returns:
        the host name
      • setHostName

        public DeploymentInfo setHostName​(java.lang.String hostName)
      • isDenyUncoveredHttpMethods

        public boolean isDenyUncoveredHttpMethods()
      • setDenyUncoveredHttpMethods

        public DeploymentInfo setDenyUncoveredHttpMethods​(boolean denyUncoveredHttpMethods)
      • isInvalidateSessionOnLogout

        public boolean isInvalidateSessionOnLogout()
      • setInvalidateSessionOnLogout

        public DeploymentInfo setInvalidateSessionOnLogout​(boolean invalidateSessionOnLogout)
      • getDefaultCookieVersion

        public int getDefaultCookieVersion()
      • setDefaultCookieVersion

        public DeploymentInfo setDefaultCookieVersion​(int defaultCookieVersion)
      • addPrincipalVsRoleMapping

        public DeploymentInfo addPrincipalVsRoleMapping​(java.lang.String principal,
                                                        java.lang.String mapping)
      • addPrincipalVsRoleMappings

        public DeploymentInfo addPrincipalVsRoleMappings​(java.lang.String principal,
                                                         java.lang.String... mappings)
      • addPrincipalVsRoleMappings

        public DeploymentInfo addPrincipalVsRoleMappings​(java.lang.String principal,
                                                         java.util.Collection<java.lang.String> mappings)
      • getPrincipalVersusRolesMap

        public java.util.Map<java.lang.String,​java.util.Set<java.lang.String>> getPrincipalVersusRolesMap()
      • clearLoginMethods

        public DeploymentInfo clearLoginMethods()
        Removes all configured authentication mechanisms from the deployment.
        Returns:
        this deployment info
      • addFirstAuthenticationMechanism

        public DeploymentInfo addFirstAuthenticationMechanism​(java.lang.String name,
                                                              io.undertow.security.api.AuthenticationMechanism mechanism)
        Adds an authentication mechanism directly to the deployment. This mechanism will be first in the list. In general you should just use addAuthenticationMechanism(String, io.undertow.security.api.AuthenticationMechanismFactory) and allow the user to configure the methods they want by name. This method is essentially a convenience method, if is the same as registering a factory under the provided name that returns and authentication mechanism, and then adding it to the login config list. If you want your mechanism to be the only one in the deployment you should first invoke clearLoginMethods().
        Parameters:
        name - The authentication mechanism name
        mechanism - The mechanism
        Returns:
        this deployment info
      • addLastAuthenticationMechanism

        public DeploymentInfo addLastAuthenticationMechanism​(java.lang.String name,
                                                             io.undertow.security.api.AuthenticationMechanism mechanism)
        Adds an authentication mechanism directly to the deployment. This mechanism will be last in the list. In general you should just use addAuthenticationMechanism(String, io.undertow.security.api.AuthenticationMechanismFactory) and allow the user to configure the methods they want by name. This method is essentially a convenience method, if is the same as registering a factory under the provided name that returns and authentication mechanism, and then adding it to the login config list. If you want your mechanism to be the only one in the deployment you should first invoke clearLoginMethods().
        Parameters:
        name - The authentication mechanism name
        mechanism - The mechanism
        Returns:
      • addAuthenticationMechanism

        public DeploymentInfo addAuthenticationMechanism​(java.lang.String name,
                                                         io.undertow.security.api.AuthenticationMechanismFactory factory)
        Adds an authentication mechanism. The name is case insenstive, and will be converted to uppercase internally.
        Parameters:
        name - The name
        factory - The factory
        Returns:
      • getAuthenticationMechanisms

        public java.util.Map<java.lang.String,​io.undertow.security.api.AuthenticationMechanismFactory> getAuthenticationMechanisms()
      • isAuthenticationMechanismPresent

        public boolean isAuthenticationMechanismPresent​(java.lang.String mechanismName)
        Returns true if the specified mechanism is present in the login config
        Parameters:
        mechanismName - The mechanism name
        Returns:
        true if the mechanism is enabled
      • addServletExtension

        public DeploymentInfo addServletExtension​(ServletExtension servletExtension)
        Adds an additional servlet extension to the deployment. Servlet extensions are generally discovered using META-INF/services entries, however this may not be practical in all environments.
        Parameters:
        servletExtension - The servlet extension
        Returns:
        this
      • getServletExtensions

        public java.util.List<ServletExtension> getServletExtensions()
      • getJaspiAuthenticationMechanism

        public io.undertow.security.api.AuthenticationMechanism getJaspiAuthenticationMechanism()
      • setJaspiAuthenticationMechanism

        public DeploymentInfo setJaspiAuthenticationMechanism​(io.undertow.security.api.AuthenticationMechanism jaspiAuthenticationMechanism)
      • getSecurityContextFactory

        public io.undertow.security.api.SecurityContextFactory getSecurityContextFactory()
      • setSecurityContextFactory

        public DeploymentInfo setSecurityContextFactory​(io.undertow.security.api.SecurityContextFactory securityContextFactory)
      • getServerName

        public java.lang.String getServerName()
      • setServerName

        public DeploymentInfo setServerName​(java.lang.String serverName)
      • isDisableCachingForSecuredPages

        public boolean isDisableCachingForSecuredPages()
      • setDisableCachingForSecuredPages

        public DeploymentInfo setDisableCachingForSecuredPages​(boolean disableCachingForSecuredPages)
      • getExceptionHandler

        public ExceptionHandler getExceptionHandler()
        Returns the exception handler that is used by this deployment. By default this will simply log unhandled exceptions
      • setExceptionHandler

        public DeploymentInfo setExceptionHandler​(ExceptionHandler exceptionHandler)
        Sets the default exception handler for this deployment
        Parameters:
        exceptionHandler - The exception handler
        Returns:
      • isEscapeErrorMessage

        public boolean isEscapeErrorMessage()
      • setEscapeErrorMessage

        public DeploymentInfo setEscapeErrorMessage​(boolean escapeErrorMessage)
        Set if if the message passed to HttpServletResponse.sendError(int, String) should be escaped. If this is false applications must be careful not to use user provided data (such as the URI) in the message
        Parameters:
        escapeErrorMessage - If the error message should be escaped
      • addSessionListener

        public DeploymentInfo addSessionListener​(io.undertow.server.session.SessionListener sessionListener)
      • getSessionListeners

        public java.util.List<io.undertow.server.session.SessionListener> getSessionListeners()
      • getAuthenticationMode

        public io.undertow.security.api.AuthenticationMode getAuthenticationMode()
      • setAuthenticationMode

        public DeploymentInfo setAuthenticationMode​(io.undertow.security.api.AuthenticationMode authenticationMode)
        Sets if this deployment should use pro-active authentication and always authenticate if the credentials are present or constraint driven auth which will only call the authentication mechanisms for protected resources. Pro active auth means that requests for unprotected resources will still be associated with a user, which may be useful for access logging.
        Parameters:
        authenticationMode - The authentication mode to use
        Returns:
      • getDefaultMultipartConfig

        public jakarta.servlet.MultipartConfigElement getDefaultMultipartConfig()
      • setDefaultMultipartConfig

        public DeploymentInfo setDefaultMultipartConfig​(jakarta.servlet.MultipartConfigElement defaultMultipartConfig)
      • getContentTypeCacheSize

        public int getContentTypeCacheSize()
      • setContentTypeCacheSize

        public DeploymentInfo setContentTypeCacheSize​(int contentTypeCacheSize)
      • getSessionIdGenerator

        public io.undertow.server.session.SessionIdGenerator getSessionIdGenerator()
      • setSessionIdGenerator

        public DeploymentInfo setSessionIdGenerator​(io.undertow.server.session.SessionIdGenerator sessionIdGenerator)
      • isSendCustomReasonPhraseOnError

        public boolean isSendCustomReasonPhraseOnError()
      • setSendCustomReasonPhraseOnError

        public DeploymentInfo setSendCustomReasonPhraseOnError​(boolean sendCustomReasonPhraseOnError)
        If this is true then the message parameter of HttpServletResponse.sendError(int, String) and jakarta.servlet.http.HttpServletResponse#setStatus(int, String) will be used as the HTTP reason phrase in the response.
        Parameters:
        sendCustomReasonPhraseOnError - If the parameter to sendError should be used as a HTTP reason phrase
        Returns:
        this
      • isChangeSessionIdOnLogin

        public boolean isChangeSessionIdOnLogin()
      • setChangeSessionIdOnLogin

        public DeploymentInfo setChangeSessionIdOnLogin​(boolean changeSessionIdOnLogin)
      • isUseCachedAuthenticationMechanism

        public boolean isUseCachedAuthenticationMechanism()
      • setUseCachedAuthenticationMechanism

        public DeploymentInfo setUseCachedAuthenticationMechanism​(boolean useCachedAuthenticationMechanism)
        If this is set to false the the cached authenticated session mechanism won't be installed. If you want FORM and other auth methods that require caching to work then you need to install another caching based auth method (such as SSO).
        Parameters:
        useCachedAuthenticationMechanism - If Undertow should use its internal authentication cache mechanism
        Returns:
        this
      • isSecurityDisabled

        public boolean isSecurityDisabled()
      • setSecurityDisabled

        public DeploymentInfo setSecurityDisabled​(boolean securityDisabled)
      • isCheckOtherSessionManagers

        public boolean isCheckOtherSessionManagers()
      • setCheckOtherSessionManagers

        public DeploymentInfo setCheckOtherSessionManagers​(boolean checkOtherSessionManagers)
        If this is true then when an existing invalid session id is found all other deployments in the container will have their session managers checked to see if it represents a valid session. If it does then the session id will be re-used.
      • getDefaultRequestEncoding

        public java.lang.String getDefaultRequestEncoding()
      • setDefaultRequestEncoding

        public DeploymentInfo setDefaultRequestEncoding​(java.lang.String defaultRequestEncoding)
      • getDefaultResponseEncoding

        public java.lang.String getDefaultResponseEncoding()
      • setDefaultResponseEncoding

        public DeploymentInfo setDefaultResponseEncoding​(java.lang.String defaultResponseEncoding)
      • addPreCompressedResourceEncoding

        public DeploymentInfo addPreCompressedResourceEncoding​(java.lang.String encoding,
                                                               java.lang.String extension)
        Adds a pre compressed resource encoding and maps it to a file extension
        Parameters:
        encoding - The content encoding
        extension - The file extension
        Returns:
        this builder
      • getPreCompressedResources

        public java.util.Map<java.lang.String,​java.lang.String> getPreCompressedResources()
      • getContainerMajorVersion

        public int getContainerMajorVersion()
      • setContainerMajorVersion

        public DeploymentInfo setContainerMajorVersion​(int containerMajorVersion)
      • getContainerMinorVersion

        public int getContainerMinorVersion()
      • setContainerMinorVersion

        public DeploymentInfo setContainerMinorVersion​(int containerMinorVersion)
      • isPreservePathOnForward

        public boolean isPreservePathOnForward()
      • setPreservePathOnForward

        public void setPreservePathOnForward​(boolean preservePathOnForward)
      • addDeploymentCompleteListener

        public DeploymentInfo addDeploymentCompleteListener​(jakarta.servlet.ServletContextListener servletContextListener)
        Add's a listener that is only invoked once all other deployment steps have been completed The listeners contextDestroyed method will be called after all undeployment steps are undertaken
        Parameters:
        servletContextListener -
        Returns:
      • getDeploymentCompleteListeners

        public java.util.List<jakarta.servlet.ServletContextListener> getDeploymentCompleteListeners()
      • isOrphanSessionAllowed

        public boolean isOrphanSessionAllowed()
      • setOrphanSessionAllowed

        public void setOrphanSessionAllowed​(boolean allowOrphanSession)
      • clone

        public DeploymentInfo clone()
        Overrides:
        clone in class java.lang.Object