public class VaadinServletService extends VaadinService
VaadinServlet
.ATMOSPHERE_MISSING_ERROR, CANNOT_ACQUIRE_CLASSLOADER_SEVERE, 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 List<RequestHandler> |
createRequestHandlers()
Called during initialization to add the request handlers for the service.
|
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.
|
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.
|
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) . |
accessSession, addServiceDestroyListener, addSessionDestroyListener, addSessionInitListener, addUIInitListener, closeSession, createCriticalNotificationJSON, createInstantiator, createSessionExpiredJSON, createUINotFoundJSON, createVaadinSession, destroy, ensureAccessQueuePurged, ensurePushAvailable, findUI, findVaadinSession, fireSessionDestroy, fireUIInitListeners, getClassLoader, getCurrent, getCurrentRequest, getDependencyFilters, getDeploymentConfiguration, getExistingSession, getHtmlImportDependencyCache, getInstantiator, getRequestHandlers, getRouter, getSessionAttributeName, getSessionLock, getSystemMessages, getSystemMessagesProvider, handleRequest, handleSessionExpired, init, isAtmosphereAvailable, isCsrfTokenValid, isOtherSessionLocked, isResourceAvailable, isUIActive, loadInstantiators, loadSession, lockSession, modifyBootstrapPage, readFromHttpSession, reinitializeSession, removeFromHttpSession, removeSession, requestEnd, requestStart, runPendingAccessTasks, setClassLoader, setCurrent, setCurrentInstances, setDefaultClassLoader, 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()
should be overridden (or otherwise
intercepted) so it does 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 static 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, WebBrowser browser)
VaadinService
url
resource to be useful for
VaadinService.getResource(String, WebBrowser, AbstractTheme)
and
VaadinService.getResourceAsStream(String, WebBrowser, AbstractTheme)
.resolveResource
in class VaadinService
url
- the resource to resolve, not null
browser
- the web browser to resolve for, relevant for es5 vs es6
resolvingpublic 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, WebBrowser browser, AbstractTheme theme)
VaadinService
getResource
in class VaadinService
path
- 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)
VaadinService
getResourceAsStream
in class VaadinService
path
- 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)
VaadinService
getThemedUrl
in class VaadinService
url
- the URL to lookupbrowser
- the browser to use for lookuptheme
- the theme to checkCopyright © 2018. All rights reserved.