Class SwingBridgeSpringServlet

java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
com.vaadin.flow.server.VaadinServlet
com.vaadin.flow.spring.SpringServlet
vaadinx.swing.app.spring.SwingBridgeSpringServlet
All Implemented Interfaces:
jakarta.servlet.Servlet, jakarta.servlet.ServletConfig, Serializable

public class SwingBridgeSpringServlet extends com.vaadin.flow.spring.SpringServlet
The Spring Boot twin of vaadinx.swing.app.SwingBridgeVaadinServlet: a SpringServlet whose session lock is virtual-thread-aware, so SB-Emulators' modal dialogs can park (D_vt_aware_session_lock, R_match_swing_errors case (9)).

A migrated app does not normally name this class. SwingBridgeAutoConfiguration registers it, so the Spring lane's host app writes no servlet at all. Name it only to subclass it.

Why not the Vaadin Boot class. On Spring the servlet has to extend SpringServlet so Vaadin's bean-based route and instantiator discovery keeps working, and Java has one superclass — so the wrap is reproduced here rather than inherited. The two classes are deliberately the same shape: createServletService is final and createSwingBridgeService(DeploymentConfiguration) is the seam, so neither the wrap nor service.init() can be lost by a subclass.

SpringServlet.context is private final, so this class keeps its own copy — SpringVaadinServletService needs one and the supertype will not hand it over.

See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    A SpringVaadinServletService whose session lock is virtual-thread-aware.
  • Field Summary

    Fields inherited from class com.vaadin.flow.spring.SpringServlet

    PROPERTY_NAMES

    Fields inherited from class com.vaadin.flow.server.VaadinServlet

    INTERNAL_VAADIN_SERVLET_VITE_DEV_MODE_FRONTEND_PATH

    Fields inherited from class jakarta.servlet.http.HttpServlet

    LEGACY_DO_HEAD
  • Constructor Summary

    Constructors
    Constructor
    Description
    SwingBridgeSpringServlet(org.springframework.context.ApplicationContext context, boolean rootMapping)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected final com.vaadin.flow.server.VaadinServletService
    createServletService(com.vaadin.flow.function.DeploymentConfiguration configuration)
    final for the same reason as the Vaadin Boot twin's: this is the seam through which the session-lock wrap could be lost silently, and losing it surfaces later and elsewhere as a StackOverflowError in Vaadin internals.
    createSwingBridgeService(com.vaadin.flow.function.DeploymentConfiguration configuration)
    The service this servlet runs on, before init().

    Methods inherited from class com.vaadin.flow.spring.SpringServlet

    createDeploymentConfiguration, service

    Methods inherited from class com.vaadin.flow.server.VaadinServlet

    createDeploymentConfiguration, createServletService, createStaticFileHandler, createVaadinRequest, destroy, getCurrent, getFrontendMapping, getLastPathParameter, getService, getServletConfig, handleContextOrServletRootWithoutSlash, init, serveStaticOrWebJarRequest, servletInitialized, whenFrontendMappingAvailable

    Methods inherited from class jakarta.servlet.http.HttpServlet

    doDelete, doGet, doHead, doOptions, doPatch, doPost, doPut, doTrace, getLastModified, isSensitiveHeader, service

    Methods inherited from class jakarta.servlet.GenericServlet

    getInitParameter, getInitParameterNames, getServletContext, getServletInfo, getServletName, init, log, log

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SwingBridgeSpringServlet

      public SwingBridgeSpringServlet(org.springframework.context.ApplicationContext context, boolean rootMapping)
  • Method Details

    • createServletService

      protected final com.vaadin.flow.server.VaadinServletService createServletService(com.vaadin.flow.function.DeploymentConfiguration configuration) throws com.vaadin.flow.server.ServiceException
      final for the same reason as the Vaadin Boot twin's: this is the seam through which the session-lock wrap could be lost silently, and losing it surfaces later and elsewhere as a StackOverflowError in Vaadin internals. Override createSwingBridgeService(DeploymentConfiguration).
      Overrides:
      createServletService in class com.vaadin.flow.spring.SpringServlet
      Throws:
      com.vaadin.flow.server.ServiceException
    • createSwingBridgeService

      protected SwingBridgeSpringServlet.SwingBridgeSpringVaadinServletService createSwingBridgeService(com.vaadin.flow.function.DeploymentConfiguration configuration) throws com.vaadin.flow.server.ServiceException
      The service this servlet runs on, before init(). Override to add your own service behaviour; the return type is what keeps the session-lock wrap in place whatever you return.
      Returns:
      a new instance, uninitialized — createServletService(DeploymentConfiguration) calls init()
      Throws:
      com.vaadin.flow.server.ServiceException