Class SpringServlet

java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
com.vaadin.flow.server.VaadinServlet
com.vaadin.flow.spring.SpringServlet
All Implemented Interfaces:
jakarta.servlet.Servlet, jakarta.servlet.ServletConfig, Serializable
Direct Known Subclasses:
MockSpringServlet

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:

Author:
Vaadin Ltd
See Also:
  • Field Details

    • PROPERTY_NAMES

      protected static final List<String> PROPERTY_NAMES
      Property names that are read from the application.properties file
  • Constructor Details

    • SpringServlet

      public SpringServlet(org.springframework.context.ApplicationContext context, boolean rootMapping)
      Creates a new Vaadin servlet instance with the application context provided.

      Use true as a value for forwardingEnforced parameter if your servlet is mapped to the root ("/*"). In the case of root mapping a RootMappedCondition is checked and VaadinServletConfiguration is applied conditionally. This configuration provide a ServletForwardingController so 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 use false for the forwardingEnforced parameter.

      Parameters:
      context - the Spring application context
      rootMapping - the incoming HttpServletRequest is wrapped in ForwardingRequestWrapper if true
  • Method Details

    • service

      protected void service(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws jakarta.servlet.ServletException, IOException
      Description copied from class: VaadinServlet
      Receives standard HTTP requests from the public service method and dispatches them.
      Overrides:
      service in class VaadinServlet
      Parameters:
      request - the object that contains the request the client made of the servlet.
      response - the object that contains the response the servlet returns to the client.
      Throws:
      jakarta.servlet.ServletException - if an input or output error occurs while the servlet is handling the TRACE request.
      IOException - if the request for the TRACE cannot be handled.
    • createServletService

      protected VaadinServletService createServletService(DeploymentConfiguration deploymentConfiguration) throws ServiceException
      Description copied from class: VaadinServlet
      Creates a vaadin servlet service.
      Overrides:
      createServletService in class VaadinServlet
      Parameters:
      deploymentConfiguration - the deployment configuration to be used
      Returns:
      the created vaadin servlet service
      Throws:
      ServiceException - if creating the vaadin servlet service fails
    • createDeploymentConfiguration

      protected DeploymentConfiguration createDeploymentConfiguration(Properties initParameters)
      Description copied from class: VaadinServlet
      Creates a deployment configuration to be used for the creation of a VaadinService. Override this if you want to override certain properties.
      Overrides:
      createDeploymentConfiguration in class VaadinServlet
      Parameters:
      initParameters - the context-param and init-param values as properties
      Returns:
      the created deployment configuration