Package io.undertow.servlet
Class Servlets
java.lang.Object
io.undertow.servlet.Servlets
Utility class for building servlet deployments.
- Author:
- Stuart Douglas
-
Method Summary
Modifier and TypeMethodDescriptionstatic ServletContainerReturns the default servlet container.static DeploymentInfoCreates a new servlet deployment info structurestatic ErrorPageCreate an ErrorPage that corresponds to the default error pagestatic ErrorPageCreate an ErrorPage instance for a given response codestatic ErrorPageCreate an ErrorPage instance for a given exception typestatic FilterInfoCreates a new filter description with the given class.static FilterInfoCreates a new filter description with the given name and classstatic FilterInfofilter(String name, Class<? extends jakarta.servlet.Filter> filterClass, InstanceFactory<? extends jakarta.servlet.Filter> filter) Creates a new filter description with the given name and classstatic ListenerInfolistener(Class<? extends EventListener> listenerClass) static ListenerInfolistener(Class<? extends EventListener> listenerClass, InstanceFactory<? extends EventListener> instanceFactory) static LoginConfigloginConfig(String realmName) static LoginConfigloginConfig(String mechanismName, String realmName) static LoginConfigloginConfig(String realmName, String loginPage, String errorPage) static LoginConfigloginConfig(String mechanismName, String realmName, String loginPage, String errorPage) static jakarta.servlet.MultipartConfigElementmultipartConfig(String location, long maxFileSize, long maxRequestSize, int fileSizeThreshold) Creates a new multipart config elementstatic ServletContainerCreates a new servlet container.static SecurityConstraintstatic ServletInfoCreates a new servlet description with the given class.static ServletInfoCreates a new servlet description with the given name and classstatic ServletInfoservlet(String name, Class<? extends jakarta.servlet.Servlet> servletClass, InstanceFactory<? extends jakarta.servlet.Servlet> servlet) Creates a new servlet description with the given name and classstatic WebResourceCollection
-
Method Details
-
defaultContainer
Returns the default servlet container. For most embedded use cases this will be sufficient.- Returns:
- The default servlet container
-
newContainer
Creates a new servlet container.- Returns:
- A new servlet container
-
deployment
Creates a new servlet deployment info structure- Returns:
- A new deployment info structure
-
servlet
Creates a new servlet description with the given class. The servlet name is inferred from the simple name of the class.- Parameters:
servletClass- The servlet class- Returns:
- A new servlet description
-
servlet
public static ServletInfo servlet(String name, Class<? extends jakarta.servlet.Servlet> servletClass) Creates a new servlet description with the given name and class- Parameters:
name- The servlet nameservletClass- The servlet class- Returns:
- A new servlet description
-
servlet
public static ServletInfo servlet(String name, Class<? extends jakarta.servlet.Servlet> servletClass, InstanceFactory<? extends jakarta.servlet.Servlet> servlet) Creates a new servlet description with the given name and class- Parameters:
name- The servlet nameservletClass- The servlet class- Returns:
- A new servlet description
-
filter
Creates a new filter description with the given class. The filter name is inferred from the simple name of the class.- Parameters:
filterClass- The filter class- Returns:
- A new filter description
-
filter
Creates a new filter description with the given name and class- Parameters:
name- The filter namefilterClass- The filter class- Returns:
- A new filter description
-
filter
public static FilterInfo filter(String name, Class<? extends jakarta.servlet.Filter> filterClass, InstanceFactory<? extends jakarta.servlet.Filter> filter) Creates a new filter description with the given name and class- Parameters:
name- The filter namefilterClass- The filter class- Returns:
- A new filter description
-
multipartConfig
public static jakarta.servlet.MultipartConfigElement multipartConfig(String location, long maxFileSize, long maxRequestSize, int fileSizeThreshold) Creates a new multipart config element- Parameters:
location- the directory location where files will be storedmaxFileSize- the maximum size allowed for uploaded filesmaxRequestSize- the maximum size allowed for multipart/form-data requestsfileSizeThreshold- the size threshold after which files will be written to disk
-
listener
public static ListenerInfo listener(Class<? extends EventListener> listenerClass, InstanceFactory<? extends EventListener> instanceFactory) -
listener
-
securityConstraint
-
webResourceCollection
-
loginConfig
-
loginConfig
-
loginConfig
public static LoginConfig loginConfig(String mechanismName, String realmName, String loginPage, String errorPage) -
loginConfig
-
errorPage
Create an ErrorPage instance for a given exception type- Parameters:
location- The location to redirect toexceptionType- The exception type- Returns:
- The error page definition
-
errorPage
Create an ErrorPage instance for a given response code- Parameters:
location- The location to redirect tostatusCode- The status code- Returns:
- The error page definition
-
errorPage
Create an ErrorPage that corresponds to the default error page- Parameters:
location- The error page location- Returns:
- The error page instance
-