Package com.vaadin.testbench.unit.mocks
Class MockSpringServlet
-
- All Implemented Interfaces:
-
jakarta.servlet.Servlet,jakarta.servlet.ServletConfig,java.io.Serializable
public class MockSpringServlet extends SpringServletMakes sure that the routes are properly registered, and that MockSpringServletService is used instead of vanilla com.vaadin.flow.spring.SpringVaadinServletService.
mavi
-
-
Field Summary
Fields Modifier and Type Field Description public final Routesroutespublic final ApplicationContextctxpublic final UIFactoryuiFactorypublic final static StringINTERNAL_VAADIN_SERVLET_VITE_DEV_MODE_FRONTEND_PATHpublic static StringfrontendMappingpublic final static StringLEGACY_DO_HEAD
-
Constructor Summary
Constructors Constructor Description MockSpringServlet(Routes routes, ApplicationContext ctx, Function0<UI> uiFactory)MockSpringServlet(Routes routes, ApplicationContext ctx, UIFactory uiFactory)
-
Method Summary
Modifier and Type Method Description static voidapplySpringSecurityIfPresent(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
-
-
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
-
-
-
-