Package com.vaadin.browserless.mocks
Class MockSpringServletService
java.lang.Object
com.vaadin.flow.server.VaadinService
com.vaadin.flow.server.VaadinServletService
com.vaadin.flow.spring.SpringVaadinServletService
com.vaadin.browserless.mocks.MockSpringServletService
- All Implemented Interfaces:
Serializable
A mocking service that performs three very important tasks:
- Overrides
isAtmosphereAvailable()to tell Vaadin that we don't have Atmosphere (otherwise Vaadin will crash) - Provides some dummy value as a root ID via
getMainDivId(com.vaadin.flow.server.VaadinSession, com.vaadin.flow.server.VaadinRequest)(otherwise the mocked servlet env will crash). - Provides a
MockSpringVaadinSessioninstead ofcom.vaadin.flow.spring.SpringVaadinSession.
For internal use only. May be renamed or removed in a future release.
- Since:
- 1.0
- Author:
- mavi
- See Also:
-
Field Summary
Fields inherited from class com.vaadin.flow.server.VaadinService
ATMOSPHERE_MISSING_ERROR, INVALID_ATMOSPHERE_VERSION_WARNING -
Constructor Summary
ConstructorsConstructorDescriptionMockSpringServletService(@NonNull MockSpringServlet servlet, @NonNull DeploymentConfiguration deploymentConfiguration, @NonNull org.springframework.context.ApplicationContext ctx, @NonNull UIFactory uiFactory) Creates the service. -
Method Summary
Modifier and TypeMethodDescriptionprotected VaadinSessioncreateVaadinSession(VaadinRequest request) Creates a new Vaadin session for this service and request.getMainDivId(VaadinSession session, VaadinRequest request) Creates and returns a unique ID for the DIV where the UI is to be rendered.protected booleanChecks whether Atmosphere is available for use.Methods inherited from class com.vaadin.flow.spring.SpringVaadinServletService
createDefaultExecutor, getExecutor, getStaticResource, init, loadInstantiatorsMethods inherited from class com.vaadin.flow.server.VaadinServletService
constructVaadinContext, createRequestHandlers, createSessionlessRequestHandlers, getContextRootRelativePath, getCurrentResponse, getCurrentServletRequest, getMimeType, getPwaRegistry, getResource, getResourceAsStream, getResourceInServletContext, getRouteRegistry, getServiceName, getServlet, requestCanCreateSession, resolveResource, setDefaultClassLoaderMethods inherited from class com.vaadin.flow.server.VaadinService
accessSession, addRpcInvocationListener, addServiceDestroyListener, addSessionDestroyListener, addSessionInitListener, addSessionLockListener, addUIInitListener, applySessionLockCheckStrategy, closeSession, createCriticalNotificationJSON, createCriticalNotificationJSON, createDefaultObjectMapper, createInstantiator, createSessionExpiredJSON, createUINotFoundJSON, createVaadinRequestInterceptors, destroy, ensureAccessQueuePurged, ensurePushAvailable, findUI, findVaadinSession, fireSessionDestroy, fireUIInitListeners, getBootstrapInitialPredicate, getBootstrapUrlPredicate, getClassLoader, getContext, getCsrfTokenAttributeName, getCurrent, getCurrentOrThrow, getCurrentRequest, getDependencyFilters, getDeploymentConfiguration, getEventBus, getExistingSession, getInstantiator, getRequestHandlers, getRouter, getSessionAttributeName, getSessionlessRequestHandlers, getSessionLock, getSystemMessages, getSystemMessagesProvider, getVaadinRequestInterceptors, handleRequest, handleSessionExpired, isCsrfTokenValid, isInitialized, isOtherSessionLocked, isResourceAvailable, isUIActive, loadSession, lockSession, modifyIndexHtmlResponse, readFromHttpSession, recordRequestFailure, reinitializeSession, removeFromHttpSession, removeSession, requestEnd, requestStart, runPendingAccessTasks, setBootstrapInitialPredicate, setBootstrapUrlPredicate, setClassLoader, setCurrent, setCurrentInstances, setSystemMessagesProvider, storeSession, unlockSession, verifyNoOtherSessionLocked, whenInitialized, writeStringResponse, writeToHttpSession, writeUncachedStringResponse
-
Constructor Details
-
MockSpringServletService
public MockSpringServletService(@NonNull MockSpringServlet servlet, @NonNull DeploymentConfiguration deploymentConfiguration, @NonNull org.springframework.context.ApplicationContext ctx, @NonNull UIFactory uiFactory) Creates the service.- Parameters:
servlet- the servlet the service belongs todeploymentConfiguration- the deployment configuration to usectx- the Spring context the views are instantiated fromuiFactory- creates the UI of the session that replaces a closed session
-
-
Method Details
-
isAtmosphereAvailable
protected boolean isAtmosphereAvailable()Description copied from class:VaadinServiceChecks whether Atmosphere is available for use.- Overrides:
isAtmosphereAvailablein classVaadinService- Returns:
- true if Atmosphere is available, false otherwise
-
getMainDivId
Description copied from class:VaadinServiceCreates and returns a unique ID for the DIV where the UI is to be rendered.- Overrides:
getMainDivIdin classVaadinServletService- Parameters:
session- The service session to which the bootstrapped UI will belong.request- The request for which a div id is needed- Returns:
- the id to use in the DOM
-
createVaadinSession
Description copied from class:VaadinServiceCreates a new Vaadin session for this service and request.- Overrides:
createVaadinSessionin classVaadinService- Parameters:
request- The request for which to create a VaadinSession- Returns:
- A new VaadinSession
-