public class VaadinPortletService extends VaadinService
URL_PARAMETER_CLOSE_APPLICATION, URL_PARAMETER_RESTART_APPLICATION| Constructor and Description |
|---|
VaadinPortletService(VaadinPortlet portlet,
DeploymentConfiguration deploymentConfiguration) |
| Modifier and Type | Method and Description |
|---|---|
protected List<RequestHandler> |
createRequestHandlers()
Called during initialization to add the request handlers for the service.
|
protected VaadinSession |
createVaadinSession(VaadinRequest request)
Creates a new Vaadin session for this service and request.
|
File |
getBaseDirectory()
Returns the context base directory.
|
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 javax.portlet.PortletRequest |
getCurrentPortletRequest()
Gets the currently processed portlet request.
|
static VaadinPortletRequest |
getCurrentRequest()
Gets the currently processed Vaadin portlet request.
|
static VaadinPortletResponse |
getCurrentResponse()
Gets the currently processed Vaadin portlet response.
|
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.
|
VaadinPortlet |
getPortlet()
Retrieves a reference to the portlet associated with this service.
|
protected VaadinPortlet.RequestType |
getRequestType(VaadinRequest request)
Deprecated.
As of 7.0. Will likely change or be removed in a future
version
|
String |
getServiceName()
Gets a unique name for this service.
|
protected Lock |
getSessionLock(WrappedSession wrappedSession)
Gets the lock instance used to lock the VaadinSession associated with the
given wrapped session.
|
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.
|
protected void |
handleSessionExpired(VaadinRequest request,
VaadinResponse response)
Called when the session has expired and the request handling is therefore
aborted.
|
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.
|
boolean |
preserveUIOnRefresh(UIProvider provider,
UICreateEvent event)
Always preserve UIs in portlets to make portlet actions work.
|
protected VaadinSession |
readFromHttpSession(WrappedSession wrappedSession)
Performs the actual read of the VaadinSession from the underlying HTTP
session after sanity checks have been performed.
|
protected void |
removeFromHttpSession(WrappedSession wrappedSession)
Performs the actual removal of the VaadinSession from the underlying HTTP
session after sanity checks have been performed.
|
protected boolean |
requestCanCreateSession(VaadinRequest request)
Checks whether it's valid to create a new service session as a result of
the given request.
|
protected void |
setSessionLock(WrappedSession wrappedSession,
Lock lock)
Associates the given lock with this service and the given wrapped
session.
|
protected void |
writeToHttpSession(WrappedSession wrappedSession,
VaadinSession session)
Performs the actual write of the VaadinSession to the underlying HTTP
session after sanity checks have been performed.
|
accessSession, addServiceDestroyListener, addSessionDestroyListener, addSessionInitListener, cleanupSession, closeSession, createCriticalNotificationJSON, criticalNotification, destroy, ensureAccessQueuePurged, ensurePushAvailable, findUI, findVaadinSession, fireSessionDestroy, generateConnectorId, getApplicationUrl, getClassLoader, getCurrent, getDependencyFilters, getDeploymentConfiguration, getExistingSession, getLockAttributeName, getRequestHandlers, getServiceInitListeners, getSessionAttributeName, getSystemMessages, getSystemMessagesProvider, handleRequest, init, initConnectorIdGenerator, initDependencyFilters, isAtmosphereAvailable, isCsrfTokenValid, isOtherSessionLocked, isUIActive, loadSession, lockSession, reinitializeSession, removeServiceDestroyListener, removeSession, removeSessionDestroyListener, removeSessionInitListener, requestEnd, requestStart, runPendingAccessTasks, setClassLoader, setCurrent, setCurrentInstances, setDefaultClassLoader, setSystemMessagesProvider, storeSession, unlockSession, verifyNoOtherSessionLocked, writeStringResponse, writeUncachedStringResponsepublic VaadinPortletService(VaadinPortlet portlet, DeploymentConfiguration deploymentConfiguration) throws ServiceException
ServiceExceptionprotected List<RequestHandler> createRequestHandlers() throws ServiceException
VaadinServicecreateRequestHandlers in class VaadinServiceServiceException - if a problem occurs when creating the request handlerspublic VaadinPortlet getPortlet()
public String getConfiguredWidgetset(VaadinRequest request)
VaadinServicegetConfiguredWidgetset in class VaadinServicerequest - the request for which a widgetset is requiredpublic String getConfiguredTheme(VaadinRequest request)
VaadinServicegetConfiguredTheme in class VaadinServicerequest - the request for which a theme is requiredpublic boolean isStandalone(VaadinRequest request)
VaadinServiceisStandalone in class VaadinServicerequest - the request for which the UI is loadedpublic String getStaticFileLocation(VaadinRequest request)
VaadinServicegetStaticFileLocation in class VaadinServicerequest - the request for which the location should be determinedpublic String getMimeType(String resourceName)
VaadinServicegetMimeType in class VaadinServiceresourceName - a String specifying the name of a fileServletContext.getMimeType(String),
PortletContext.getMimeType(String)public File getBaseDirectory()
VaadinServicegetBaseDirectory in class VaadinServiceprotected boolean requestCanCreateSession(VaadinRequest request)
VaadinServicerequestCanCreateSession in class VaadinServicerequest - the requesttrue if it's valid to create a new service session
for the request; else false@Deprecated protected VaadinPortlet.RequestType getRequestType(VaadinRequest request)
request - the request to get a request type forpublic static javax.portlet.PortletRequest getCurrentPortletRequest()
nullpublic static VaadinPortletRequest getCurrentRequest()
nullpublic static VaadinPortletResponse getCurrentResponse()
nullprotected VaadinSession createVaadinSession(VaadinRequest request) throws ServiceException
VaadinServicecreateVaadinSession in class VaadinServicerequest - The request for which to create a VaadinSessionServiceExceptionpublic String getServiceName()
VaadinServicegetServiceName in class VaadinServicepublic boolean preserveUIOnRefresh(UIProvider provider, UICreateEvent event)
preserveUIOnRefresh in class VaadinServiceprovider - the UI provider responsible for the UIevent - the UI create event with details about the UItrue if the UI should be preserved on refresh;
false if a new UI instance should be initialized on
refreshed.public InputStream getThemeResourceAsStream(UI uI, String themeName, String resource)
VaadinServicegetThemeResourceAsStream in class VaadinServiceuI - The ui for which to find the resourcethemeName - The name of the themeresource - The name of the resource, e.g. "layouts/mycustomlayout.html"public String getMainDivId(VaadinSession session, VaadinRequest request, Class<? extends UI> uiClass)
VaadinServicegetMainDivId in class VaadinServicesession - 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 bootstrappedprotected void handleSessionExpired(VaadinRequest request, VaadinResponse response)
VaadinServicehandleSessionExpired in class VaadinServicerequest - The requestresponse - The responseprotected void writeToHttpSession(WrappedSession wrappedSession, VaadinSession session)
VaadinService
Called by VaadinService.storeSession(VaadinSession, WrappedSession)
writeToHttpSession in class VaadinServicewrappedSession - the underlying HTTP sessionsession - the VaadinSession to storeprotected VaadinSession readFromHttpSession(WrappedSession wrappedSession)
VaadinService
Called by VaadinService.loadSession(WrappedSession).
readFromHttpSession in class VaadinServicewrappedSession - the underlying HTTP sessionprotected void removeFromHttpSession(WrappedSession wrappedSession)
VaadinServiceremoveFromHttpSession in class VaadinServicewrappedSession - the underlying HTTP sessionprotected void setSessionLock(WrappedSession wrappedSession, Lock lock)
VaadinServicesetSessionLock in class VaadinServicewrappedSession - The wrapped session the lock is associated withlock - The lock objectVaadinService.getSessionLock(WrappedSession)protected Lock getSessionLock(WrappedSession wrappedSession)
VaadinServiceThis method uses the wrapped session instead of VaadinSession to be able to lock even before the VaadinSession has been initialized.
getSessionLock in class VaadinServicewrappedSession - The wrapped sessionCopyright © 2022 Vaadin Ltd. All rights reserved.