Package com.vaadin.flow.spring
Class SpringServlet
- java.lang.Object
-
- javax.servlet.GenericServlet
-
- javax.servlet.http.HttpServlet
-
- com.vaadin.flow.server.VaadinServlet
-
- com.vaadin.flow.spring.SpringServlet
-
- All Implemented Interfaces:
Serializable,javax.servlet.Servlet,javax.servlet.ServletConfig
public class SpringServlet extends VaadinServlet
Spring application context aware Vaadin servlet implementation.This class is not intended to be used directly. It's instantiated automatically by the Spring add-on:
- Spring boot does this via
SpringBootAutoConfiguration. - In case of using Spring MVC just extends
VaadinMVCWebAppInitializer.
- Author:
- Vaadin Ltd
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected static List<String>PROPERTY_NAMESProperty names that are read from the application.properties file-
Fields inherited from class com.vaadin.flow.server.VaadinServlet
INTERNAL_VAADIN_SERVLET_VITE_DEV_MODE_FRONTEND_PATH
-
-
Constructor Summary
Constructors Constructor Description SpringServlet(org.springframework.context.ApplicationContext context, boolean rootMapping)Creates a new Vaadin servlet instance with the applicationcontextprovided.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected DeploymentConfigurationcreateDeploymentConfiguration(Properties initParameters)protected VaadinServletServicecreateServletService(DeploymentConfiguration deploymentConfiguration)protected voidservice(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)-
Methods inherited from class com.vaadin.flow.server.VaadinServlet
createDeploymentConfiguration, createServletService, createStaticFileHandler, createVaadinRequest, destroy, getCurrent, getFrontendMapping, getLastPathParameter, getService, getServletConfig, handleContextOrServletRootWithoutSlash, init, serveStaticOrWebJarRequest, servletInitialized
-
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
-
-
-
-
Constructor Detail
-
SpringServlet
public SpringServlet(org.springframework.context.ApplicationContext context, boolean rootMapping)Creates a new Vaadin servlet instance with the applicationcontextprovided.Use
trueas a value forforwardingEnforcedparameter if your servlet is mapped to the root ("/*"). In the case of root mapping aRootMappedConditionis checked andVaadinServletConfigurationis applied conditionally. This configuration provide aServletForwardingControllerso that other Spring endpoints may co-exist with Vaadin application (it's required since root mapping handles any request to the context). This is not needed if you are using non-root mapping since are you free to use the mapping which doesn't overlap with any endpoint mapping. In this case usefalsefor theforwardingEnforcedparameter.- Parameters:
context- the Spring application contextrootMapping- the incoming HttpServletRequest is wrapped in ForwardingRequestWrapper iftrue
-
-
Method Detail
-
service
protected void service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException- Overrides:
servicein classVaadinServlet- Throws:
javax.servlet.ServletExceptionIOException
-
createServletService
protected VaadinServletService createServletService(DeploymentConfiguration deploymentConfiguration) throws ServiceException
- Overrides:
createServletServicein classVaadinServlet- Throws:
ServiceException
-
createDeploymentConfiguration
protected DeploymentConfiguration createDeploymentConfiguration(Properties initParameters)
- Overrides:
createDeploymentConfigurationin classVaadinServlet
-
-