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 ) . |
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, 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, setSystemMessagesProvider, storeSession, unlockSession, verifyNoOtherSessionLocked, writeStringResponse, writeToHttpSession, writeUncachedStringResponse
public 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
VaadinService
createRequestHandlers
in class VaadinService
ServiceException
- if a problem occurs when creating the request handlerspublic VaadinServlet getServlet()
public String getMimeType(String resourceName)
VaadinService
getMimeType
in class VaadinService
resourceName
- a String specifying the name of a fileServletContext.getMimeType(String)
protected boolean requestCanCreateSession(VaadinRequest request)
VaadinService
requestCanCreateSession
in class VaadinService
request
- the requesttrue
if it's valid to create a new service session
for the request; else false
public void init() throws ServiceException
VaadinService
init
in class VaadinService
ServiceException
- if a problem occurs when creating the servicepublic static javax.servlet.http.HttpServletRequest getCurrentServletRequest()
public static VaadinServletResponse getCurrentResponse()
public String getServiceName()
VaadinService
getServiceName
in class VaadinService
public String getMainDivId(VaadinSession session, VaadinRequest request)
VaadinService
getMainDivId
in class VaadinService
session
- The service session to which the bootstrapped UI will belong.request
- The request for which a div id is neededprotected RouteRegistry getRouteRegistry()
VaadinService
getRouteRegistry
in class VaadinService
null
protected PwaRegistry getPwaRegistry()
getPwaRegistry
in class VaadinService
public String resolveResource(String url)
VaadinService
url
resource to be useful for
VaadinService.getResource(String)
and VaadinService.getResourceAsStream(String )
.resolveResource
in class VaadinService
url
- the resource to resolve, not null
public URL getStaticResource(String path)
VaadinService
getStaticResource
in class VaadinService
path
- the URL for the resourcenull
if
there is no resource at that pathpublic URL getResource(String path)
VaadinService
getResource
in class VaadinService
path
- the untranslated Vaadin URL for the resourcenull
if
there is no resource at that pathpublic InputStream getResourceAsStream(String path)
VaadinService
getResourceAsStream
in class VaadinService
path
- 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)
VaadinService
getContextRootRelativePath
in class VaadinService
request
- Request.protected VaadinContext constructVaadinContext()
VaadinService
VaadinContext
for this service.
This method will be called only once, upon first call to
VaadinService.getContext()
.constructVaadinContext
in class VaadinService
null
.protected void setDefaultClassLoader()
VaadinService
VaadinService
if found. If current security policy disallows
acquiring class loader instance it will log a message and re-throw
SecurityException
setDefaultClassLoader
in class VaadinService
Copyright © 2024. All rights reserved.