Class MockSpringServlet

  • All Implemented Interfaces:
    jakarta.servlet.Servlet , jakarta.servlet.ServletConfig , java.io.Serializable

    
    public class MockSpringServlet
    extends SpringServlet
                        

    Makes sure that the routes are properly registered, and that MockSpringServletService is used instead of vanilla com.vaadin.flow.spring.SpringVaadinServletService.

    Author:

    mavi

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Constructor Summary

      Constructors 
      Constructor Description
      MockSpringServlet(Routes routes, ApplicationContext ctx, Function0<UI> uiFactory)
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      static void applySpringSecurityIfPresent(MockRequest request) Augments the mock HTTP request backed by Vaadin request, with authentication information provided by Spring Security framework.
      • Methods inherited from class com.vaadin.flow.server.VaadinServlet

        destroy, getCurrent, getFrontendMapping, getService, getServletConfig, init, whenFrontendMappingAvailable
      • Methods inherited from class jakarta.servlet.GenericServlet

        getInitParameter, getInitParameterNames, getServletContext, getServletInfo, getServletName, log
      • Methods inherited from class java.lang.Object

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

      • MockSpringServlet

        MockSpringServlet(Routes routes, ApplicationContext ctx, Function0<UI> uiFactory)
    • Method Detail

      • applySpringSecurityIfPresent

         static void applySpringSecurityIfPresent(MockRequest request)

        Augments the mock HTTP request backed by Vaadin request, with authentication information provided by Spring Security framework. Nothing is done if Spring Security is not present on classpath.

        Parameters:
        request - the mock request instance