public class VaadinServletService extends VaadinService
VaadinServlet.ATMOSPHERE_MISSING_ERROR, CANNOT_ACQUIRE_CLASSLOADER_SEVERE, INVALID_ATMOSPHERE_VERSION_WARNING| 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 javax.servlet.http.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)
Returns a URL to the resource at the given Vaadin URI.
|
InputStream |
getResourceAsStream(String path)
Opens a stream to to the resource at the given Vaadin URI.
|
URL |
getResourceInServletContext(String path)
Finds the given resource in the servlet context.
|
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.
|
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)
Resolves the given
url resource to be useful for
VaadinService.getResource(String) and VaadinService.getResourceAsStream(String ). |
accessSession, addServiceDestroyListener, addSessionDestroyListener, addSessionInitListener, addUIInitListener, closeSession, createCriticalNotificationJSON, createCriticalNotificationJSON, createInstantiator, createSessionExpiredJSON, createUINotFoundJSON, createVaadinSession, destroy, ensureAccessQueuePurged, ensurePushAvailable, findUI, findVaadinSession, fireSessionDestroy, fireUIInitListeners, getBootstrapInitialPredicate, getBootstrapUrlPredicate, getClassLoader, getContext, getCsrfTokenAttributeName, getCurrent, getCurrentRequest, getDependencyFilters, getDeploymentConfiguration, getExistingSession, getInstantiator, getRequestHandlers, getRouter, getSessionAttributeName, getSessionLock, getSystemMessages, getSystemMessagesProvider, handleRequest, handleSessionExpired, isAtmosphereAvailable, isCsrfTokenValid, isOtherSessionLocked, isResourceAvailable, isUIActive, loadInstantiators, loadSession, lockSession, modifyBootstrapPage, modifyIndexHtmlResponse, readFromHttpSession, reinitializeSession, removeFromHttpSession, removeSession, requestEnd, requestStart, runPendingAccessTasks, setBootstrapInitialPredicate, setBootstrapUrlPredicate, setClassLoader, setCurrent, setCurrentInstances, setDefaultClassLoader, 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 javax.servlet.http.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)
VaadinServiceurl resource to be useful for
VaadinService.getResource(String) and VaadinService.getResourceAsStream(String ).resolveResource in class VaadinServiceurl - the resource to resolve, not nullpublic 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)
VaadinServicegetResource in class VaadinServicepath - the untranslated Vaadin URL for the resourcenull if
there is no resource at that pathpublic InputStream getResourceAsStream(String path)
VaadinServicegetResourceAsStream in class VaadinServicepath - the untranslated Vaadin URL for the resourcenull if no resource
exists at the specified pathpublic URL getResourceInServletContext(String path)
path - the path inside servlet contextnull 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.Copyright © 2021. All rights reserved.