Class SpringVaadinServletService
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
MockSpringServletService
- Author:
- Vaadin Ltd
- See Also:
-
Field Summary
Fields inherited from class com.vaadin.flow.server.VaadinService
ATMOSPHERE_MISSING_ERROR, INVALID_ATMOSPHERE_VERSION_WARNING
-
Constructor Summary
ConstructorsConstructorDescriptionSpringVaadinServletService
(VaadinServlet servlet, DeploymentConfiguration deploymentConfiguration, org.springframework.context.ApplicationContext context) Creates an instance connected to the given servlet and using the given configuration with provided applicationcontext
. -
Method Summary
Modifier and TypeMethodDescriptionprotected Executor
Creates a default executor instance to use with this service.protected VaadinSession
createVaadinSession
(VaadinRequest request) Creates a new Vaadin session for this service and request.Gets the executor instance used by Vaadin for managing concurrent tasks.getStaticResource
(String path) Returns a URL to the static resource at the given URI or null if no file found.void
init()
Initializes this service.protected Optional<Instantiator>
Loads and initializes instantiators.Methods inherited from class com.vaadin.flow.server.VaadinServletService
constructVaadinContext, createRequestHandlers, getContextRootRelativePath, getCurrentResponse, getCurrentServletRequest, getMainDivId, getMimeType, getPwaRegistry, getResource, getResourceAsStream, getResourceInServletContext, getRouteRegistry, getServiceName, getServlet, requestCanCreateSession, resolveResource, setDefaultClassLoader
Methods inherited from class com.vaadin.flow.server.VaadinService
accessSession, addServiceDestroyListener, addSessionDestroyListener, addSessionInitListener, addUIInitListener, closeSession, createCriticalNotificationJSON, createCriticalNotificationJSON, createDefaultObjectMapper, createInstantiator, createSessionExpiredJSON, createUINotFoundJSON, createVaadinRequestInterceptors, destroy, ensureAccessQueuePurged, ensurePushAvailable, findUI, findVaadinSession, fireSessionDestroy, fireUIInitListeners, getBootstrapInitialPredicate, getBootstrapUrlPredicate, getClassLoader, getContext, getCsrfTokenAttributeName, getCurrent, getCurrentRequest, getDependencyFilters, getDeploymentConfiguration, getExistingSession, getInstantiator, getRequestHandlers, getRouter, getSessionAttributeName, getSessionLock, getSystemMessages, getSystemMessagesProvider, getVaadinRequestInterceptors, handleRequest, handleSessionExpired, isAtmosphereAvailable, isCsrfTokenValid, isOtherSessionLocked, isResourceAvailable, isUIActive, loadSession, lockSession, modifyIndexHtmlResponse, readFromHttpSession, reinitializeSession, removeFromHttpSession, removeSession, requestEnd, requestStart, runPendingAccessTasks, setBootstrapInitialPredicate, setBootstrapUrlPredicate, setClassLoader, setCurrent, setCurrentInstances, setSystemMessagesProvider, storeSession, unlockSession, verifyNoOtherSessionLocked, writeStringResponse, writeToHttpSession, writeUncachedStringResponse
-
Constructor Details
-
SpringVaadinServletService
public SpringVaadinServletService(VaadinServlet servlet, DeploymentConfiguration deploymentConfiguration, org.springframework.context.ApplicationContext context) Creates an instance connected to the given servlet and using the given configuration with provided applicationcontext
.- Parameters:
servlet
- the servlet which receives requestsdeploymentConfiguration
- the configuration to usecontext
- the Spring application context
-
-
Method Details
-
loadInstantiators
Description copied from class:VaadinService
Loads and initializes instantiators.A custom Vaadin service implementation can override this method to pick an instantiator in some other way instead of the default implementation that uses
ServiceLoader
.There may be only one applicable instantiator. Otherwise
ServiceException
will be thrown.- Overrides:
loadInstantiators
in classVaadinService
- Returns:
- an optional instantator, or an empty optional if no instantiator found
- Throws:
ServiceException
- if there are multiple applicable instantiators- See Also:
-
createDefaultExecutor
Description copied from class:VaadinService
Creates a default executor instance to use with this service.This default implementation creates a thread pool executor with a custom thread factory to generate daemon threads. It uses a core pool size of 8, an unbounded maximum pool size, and a keep-alive time of 60 seconds for idle threads. The thread pool grows dynamically as required, and idle core threads are allowed to time out.
A custom
VaadinService
implementation can override this method to provide its own ad-hoc executor tailored to specific environments like CDI or Spring.Implementors should never return null; if an executor instance cannot be provided, the method should call
super.createDefaultExecutor()
.The application can provide a more appropriate executor implementation through a
VaadinServiceInitListener
and callingServiceInitEvent.setExecutor(Executor)
.- Overrides:
createDefaultExecutor
in classVaadinService
- Returns:
- a default executor instance to use, never null.
- See Also:
-
getExecutor
Description copied from class:VaadinService
Gets the executor instance used by Vaadin for managing concurrent tasks.By default, a thread pool executor with a custom with core pool size of 8, an unbounded maximum pool size, and a keep-alive time of 60 seconds for idle threads is provided. The thread pool grows dynamically as required, and idle core threads are allowed to time out.
VaadinService
implementations for specific environments like CDI or Spring might provide their own ad-hoc Executors tailored to those environments.A custom executor can be configured by registering a
VaadinServiceInitListener
and providing the executor instance to theServiceInitEvent
.A Vaadin application can also benefit from this executor to submit asynchronous tasks.
- Overrides:
getExecutor
in classVaadinService
- Returns:
- the Executor instance, never null.
- See Also:
-
init
Description copied from class:VaadinService
Initializes this service. The service should be initialized before it is used.- Overrides:
init
in classVaadinService
- Throws:
ServiceException
- if a problem occurs when creating the service
-
createVaadinSession
Description copied from class:VaadinService
Creates a new Vaadin session for this service and request.- Overrides:
createVaadinSession
in classVaadinService
- Parameters:
request
- The request for which to create a VaadinSession- Returns:
- A new VaadinSession
-
getStaticResource
Description copied from class:VaadinService
Returns a URL to the static resource at the given URI or null if no file found.- Overrides:
getStaticResource
in classVaadinServletService
- Parameters:
path
- the URL for the resource- Returns:
- the resource located at the named path, or
null
if there is no resource at that path
-