public class VaadinServletService extends VaadinService
VaadinServlet.ATMOSPHERE_MISSING_ERROR, INVALID_ATMOSPHERE_VERSION_WARNING, URL_PARAMETER_CLOSE_APPLICATION, URL_PARAMETER_RESTART_APPLICATION| Modifier | Constructor and Description |
|---|---|
protected |
VaadinServletService()
Creates a servlet service.
|
|
VaadinServletService(VaadinServlet servlet,
DeploymentConfiguration deploymentConfiguration)
Creates an instance connected to the given servlet and using the given
configuration.
|
| Modifier and Type | Method and Description |
|---|---|
protected VaadinContext |
constructVaadinContext()
Constructs
VaadinContext for this service. |
protected List<RequestHandler> |
createRequestHandlers()
Called during initialization to add the request handlers for the service.
|
String |
getContextRootRelativePath(VaadinRequest request)
Returns relative context path for given request.
|
static VaadinServletResponse |
getCurrentResponse() |
static HttpServletRequest |
getCurrentServletRequest() |
String |
getMainDivId(VaadinSession session,
VaadinRequest request)
Creates and returns a unique ID for the DIV where the UI is to be
rendered.
|
String |
getMimeType(String resourceName)
Returns the MIME type of the specified file, or null if the MIME type is
not known.
|
protected PwaRegistry |
getPwaRegistry() |
URL |
getResource(String path,
WebBrowser browser,
AbstractTheme theme)
Returns a URL to the resource at the given Vaadin URI.
|
InputStream |
getResourceAsStream(String path,
WebBrowser browser,
AbstractTheme theme)
Opens a stream to to the resource at the given Vaadin URI.
|
URL |
getResourceInServletContextOrWebJar(String path)
Finds the given resource in the servlet context or in a webjar.
|
protected RouteRegistry |
getRouteRegistry()
Find a route registry to use for this service.
|
String |
getServiceName()
Gets a unique name for this service.
|
VaadinServlet |
getServlet()
Retrieves a reference to the servlet associated with this service.
|
URL |
getStaticResource(String path)
Returns a URL to the static resource at the given URI or null if no file
found.
|
Optional<String> |
getThemedUrl(String url,
WebBrowser browser,
AbstractTheme theme)
Checks if the given URL has a themed version.
|
void |
init()
Initializes this service.
|
protected boolean |
requestCanCreateSession(VaadinRequest request)
Checks whether it's valid to create a new service session as a result of
the given request.
|
String |
resolveResource(String url,
WebBrowser browser)
Resolves the given
url resource to be useful for
VaadinService.getResource(String, WebBrowser, AbstractTheme) and
VaadinService.getResourceAsStream(String, WebBrowser, AbstractTheme). |
protected void |
setDefaultClassLoader()
Tries to acquire default class loader and sets it as a class loader for
this
VaadinService if found. |
accessSession, addServiceDestroyListener, addSessionDestroyListener, addSessionInitListener, addUIInitListener, closeSession, createCriticalNotificationJSON, createCriticalNotificationJSON, createInstantiator, createSessionExpiredJSON, createUINotFoundJSON, createVaadinSession, destroy, ensureAccessQueuePurged, ensurePushAvailable, findUI, findVaadinSession, fireSessionDestroy, fireUIInitListeners, getClassLoader, getContext, getCurrent, getCurrentRequest, getDependencyFilters, getDeploymentConfiguration, getExistingSession, getHtmlImportDependencyCache, getInstantiator, getRequestHandlers, getRouter, getSessionAttributeName, getSessionLock, getSystemMessages, getSystemMessagesProvider, handleRequest, handleSessionExpired, isAtmosphereAvailable, isCsrfTokenValid, isOtherSessionLocked, isResourceAvailable, isUIActive, loadInstantiators, loadSession, lockSession, modifyBootstrapPage, readFromHttpSession, reinitializeSession, removeFromHttpSession, removeSession, requestEnd, requestStart, runPendingAccessTasks, setClassLoader, setCurrent, setCurrentInstances, setSystemMessagesProvider, storeSession, unlockSession, verifyNoOtherSessionLocked, writeStringResponse, writeToHttpSession, writeUncachedStringResponsepublic VaadinServletService(VaadinServlet servlet, DeploymentConfiguration deploymentConfiguration)
servlet - the servlet which receives requestsdeploymentConfiguration - the configuration to useprotected VaadinServletService()
getServlet() and VaadinService.getContext() should be
overridden (or otherwise intercepted) to not return null.protected List<RequestHandler> createRequestHandlers() throws ServiceException
VaadinServicecreateRequestHandlers in class VaadinServiceServiceException - if a problem occurs when creating the request handlerspublic VaadinServlet getServlet()
public String getMimeType(String resourceName)
VaadinServicegetMimeType in class VaadinServiceresourceName - a String specifying the name of a fileServletContext#getMimeType(String)protected boolean requestCanCreateSession(VaadinRequest request)
VaadinServicerequestCanCreateSession in class VaadinServicerequest - the requesttrue if it's valid to create a new service session
for the request; else falsepublic void init()
throws ServiceException
VaadinServiceinit in class VaadinServiceServiceException - if a problem occurs when creating the servicepublic static HttpServletRequest getCurrentServletRequest()
public static VaadinServletResponse getCurrentResponse()
public String getServiceName()
VaadinServicegetServiceName in class VaadinServicepublic String getMainDivId(VaadinSession session, VaadinRequest request)
VaadinServicegetMainDivId in class VaadinServicesession - The service session to which the bootstrapped UI will belong.request - The request for which a div id is neededprotected RouteRegistry getRouteRegistry()
VaadinServicegetRouteRegistry in class VaadinServicenullprotected PwaRegistry getPwaRegistry()
getPwaRegistry in class VaadinServicepublic String resolveResource(String url, WebBrowser browser)
VaadinServiceurl resource to be useful for
VaadinService.getResource(String, WebBrowser, AbstractTheme) and
VaadinService.getResourceAsStream(String, WebBrowser, AbstractTheme).resolveResource in class VaadinServiceurl - the resource to resolve, not nullbrowser - the web browser to resolve for, relevant for es5 vs es6
resolvingpublic URL getStaticResource(String path)
VaadinServicegetStaticResource in class VaadinServicepath - the URL for the resourcenull if
there is no resource at that pathpublic URL getResource(String path, WebBrowser browser, AbstractTheme theme)
VaadinServicegetResource in class VaadinServicepath - the untranslated Vaadin URL for the resourcebrowser - the web browser to resolve for, relevant for es5 vs es6
resolvingtheme - the theme to use for translating the URL or null
if no theme is usednull if
there is no resource at that pathpublic InputStream getResourceAsStream(String path, WebBrowser browser, AbstractTheme theme)
VaadinServicegetResourceAsStream in class VaadinServicepath - the untranslated Vaadin URL for the resourcebrowser - the web browser to resolve for, relevant for es5 vs es6
resolvingtheme - the theme to use for translating the URL or null
if no theme is usednull if no resource
exists at the specified pathpublic Optional<String> getThemedUrl(String url, WebBrowser browser, AbstractTheme theme)
VaadinServicegetThemedUrl in class VaadinServiceurl - the URL to lookupbrowser - the browser to use for lookuptheme - the theme to checkpublic URL getResourceInServletContextOrWebJar(String path)
path - the path inside servlet context, automatically translated as
needed for webjarsnull if no resource was
foundpublic String getContextRootRelativePath(VaadinRequest request)
VaadinServicegetContextRootRelativePath in class VaadinServicerequest - Request.protected VaadinContext constructVaadinContext()
VaadinServiceVaadinContext for this service.
This method will be called only once, upon first call to
VaadinService.getContext().constructVaadinContext in class VaadinServicenull.protected void setDefaultClassLoader()
VaadinServiceVaadinService if found. If current security policy disallows
acquiring class loader instance it will log a message and re-throw
SecurityExceptionsetDefaultClassLoader in class VaadinServiceCopyright © 2025. All rights reserved.