public class VaadinServletService extends VaadinService
URL_PARAMETER_CLOSE_APPLICATION, URL_PARAMETER_RESTART_APPLICATION
Constructor and Description |
---|
VaadinServletService(VaadinServlet servlet,
DeploymentConfiguration deploymentConfiguration) |
Modifier and Type | Method and Description |
---|---|
protected List<RequestHandler> |
createRequestHandlers()
Called during initialization to add the request handlers for the service.
|
protected URL |
getApplicationUrl(VaadinRequest request)
Get the base URL that should be used for sending requests back to this
service.
|
File |
getBaseDirectory()
Returns the context base directory.
|
static String |
getCancelingRelativePath(String pathToCancel)
Gets a relative path that cancels the provided path.
|
String |
getConfiguredTheme(VaadinRequest request)
Gets the theme that is configured for this deployment, e.g.
|
String |
getConfiguredWidgetset(VaadinRequest request)
Gets the widgetset that is configured for this deployment, e.g.
|
static VaadinServletResponse |
getCurrentResponse() |
static javax.servlet.http.HttpServletRequest |
getCurrentServletRequest() |
String |
getMainDivId(VaadinSession session,
VaadinRequest request,
Class<? extends UI> uiClass)
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.
|
String |
getServiceName()
Gets a unique name for this service.
|
VaadinServlet |
getServlet()
Retrieves a reference to the servlet associated with this service.
|
String |
getStaticFileLocation(VaadinRequest request)
Return the URL from where static files, e.g.
|
InputStream |
getThemeResourceAsStream(UI uI,
String themeName,
String resource)
Finds the given theme resource from the web content folder or using the
class loader and returns a stream for it
|
boolean |
isStandalone(VaadinRequest request)
Checks whether the UI will be rendered on its own in the browser or
whether it will be included into some other context.
|
protected boolean |
requestCanCreateSession(VaadinRequest request)
Checks whether it's valid to create a new service session as a result of
the given request.
|
accessSession, addServiceDestroyListener, addSessionDestroyListener, addSessionInitListener, closeSession, createCriticalNotificationJSON, createVaadinSession, criticalNotification, destroy, ensureAccessQueuePurged, ensurePushAvailable, findUI, findVaadinSession, fireSessionDestroy, getClassLoader, getCurrent, getCurrentRequest, getDeploymentConfiguration, getExistingSession, getRequestHandlers, getSessionAttributeName, getSessionLock, getSystemMessages, getSystemMessagesProvider, handleRequest, handleSessionExpired, init, isAtmosphereAvailable, isCsrfTokenValid, isOtherSessionLocked, loadSession, lockSession, preserveUIOnRefresh, readFromHttpSession, reinitializeSession, removeFromHttpSession, removeServiceDestroyListener, removeSession, removeSessionDestroyListener, removeSessionInitListener, requestEnd, requestStart, runPendingAccessTasks, setClassLoader, setCurrent, setCurrentInstances, setDefaultClassLoader, setSystemMessagesProvider, storeSession, unlockSession, verifyNoOtherSessionLocked, writeStringResponse, writeToHttpSession
public VaadinServletService(VaadinServlet servlet, DeploymentConfiguration deploymentConfiguration) throws ServiceException
ServiceException
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 getStaticFileLocation(VaadinRequest request)
VaadinService
getStaticFileLocation
in class VaadinService
request
- the request for which the location should be determinedpublic static String getCancelingRelativePath(String pathToCancel)
pathToCancel
- the path that should be canceledpublic String getConfiguredWidgetset(VaadinRequest request)
VaadinService
getConfiguredWidgetset
in class VaadinService
request
- the request for which a widgetset is requiredpublic String getConfiguredTheme(VaadinRequest request)
VaadinService
getConfiguredTheme
in class VaadinService
request
- the request for which a theme is requiredpublic boolean isStandalone(VaadinRequest request)
VaadinService
isStandalone
in class VaadinService
request
- the request for which the UI is loadedpublic String getMimeType(String resourceName)
VaadinService
getMimeType
in class VaadinService
resourceName
- a String specifying the name of a fileServletContext.getMimeType(String)
,
PortletContext#getMimeType(String)
public File getBaseDirectory()
VaadinService
getBaseDirectory
in class VaadinService
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
protected URL getApplicationUrl(VaadinRequest request) throws MalformedURLException
VaadinService
This is only used to support legacy cases.
getApplicationUrl
in class VaadinService
MalformedURLException
public static javax.servlet.http.HttpServletRequest getCurrentServletRequest()
public static VaadinServletResponse getCurrentResponse()
public String getServiceName()
VaadinService
getServiceName
in class VaadinService
public InputStream getThemeResourceAsStream(UI uI, String themeName, String resource) throws IOException
VaadinService
getThemeResourceAsStream
in class VaadinService
uI
- The ui for which to find the resourcethemeName
- The name of the themeresource
- The name of the resource, e.g. "layouts/mycustomlayout.html"IOException
- if a problem occurred while finding or opening the resourcepublic String getMainDivId(VaadinSession session, VaadinRequest request, Class<? extends UI> uiClass)
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 neededuiClass
- The class of the UI that will be bootstrappedCopyright © 2019 Vaadin Ltd. All rights reserved.