|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.vaadin.server.VaadinService
public abstract class VaadinService
Provide deployment specific settings that are required outside terminal specific code.
| Field Summary | |
|---|---|
static java.lang.String |
URL_PARAMETER_CLOSE_APPLICATION
Deprecated. Only supported for LegacyApplication. |
static java.lang.String |
URL_PARAMETER_RESTART_APPLICATION
Deprecated. Only supported for LegacyApplication. |
| Constructor Summary | |
|---|---|
VaadinService(DeploymentConfiguration deploymentConfiguration)
Creates a new vaadin service based on a deployment configuration |
|
| Method Summary | |
|---|---|
void |
addSessionDestroyListener(SessionDestroyListener listener)
Adds a listener that gets notified when a Vaadin service session that has been initialized for this service is destroyed. |
void |
addSessionInitListener(SessionInitListener listener)
Adds a listener that gets notified when a new Vaadin service session is initialized for this service. |
void |
closeSession(VaadinServiceSession session)
Closes the VaadinServiceSession and discards all associated UI state. |
protected abstract AbstractCommunicationManager |
createCommunicationManager(VaadinServiceSession session)
Create a communication manager to use for the given service session. |
protected VaadinServiceSession |
createVaadinSession(VaadinRequest request)
Creates a new Vaadin service session. |
UI |
findUI(VaadinRequest request)
Finds the UI that belongs to the provided request. |
VaadinServiceSession |
findVaadinSession(VaadinRequest request)
Attempts to find a Vaadin service session associated with this request. |
void |
fireSessionDestroy(VaadinServiceSession vaadinSession)
|
AddonContext |
getAddonContext()
|
java.util.Iterator<AddonContextListener> |
getAddonContextListeners()
|
protected java.net.URL |
getApplicationUrl(VaadinRequest request)
Deprecated. Only used to support LegacyApplication. |
abstract java.io.File |
getBaseDirectory()
Returns the context base directory. |
java.lang.ClassLoader |
getClassLoader()
Get the class loader to use for loading classes loaded by name, e.g. |
abstract java.lang.String |
getConfiguredTheme(VaadinRequest request)
Gets the theme that is configured for this deployment, e.g. |
abstract java.lang.String |
getConfiguredWidgetset(VaadinRequest request)
Gets the widgetset that is configured for this deployment, e.g. |
static VaadinService |
getCurrent()
Gets the currently used Vaadin service. |
static VaadinRequest |
getCurrentRequest()
Gets the currently processed Vaadin request. |
static VaadinResponse |
getCurrentResponse()
Gets the currently processed Vaadin request. |
DeploymentConfiguration |
getDeploymentConfiguration()
Gets the deployment configuration. |
protected VaadinServiceSession |
getExistingSession(VaadinRequest request,
boolean allowSessionCreation)
|
abstract java.lang.String |
getMainDivId(VaadinServiceSession session,
VaadinRequest request,
java.lang.Class<? extends UI> uiClass)
Creates and returns a unique ID for the DIV where the UI is to be rendered. |
abstract java.lang.String |
getMimeType(java.lang.String resourceName)
Returns the MIME type of the specified file, or null if the MIME type is not known. |
abstract java.lang.String |
getServiceName()
Gets a unique name for this service. |
abstract java.lang.String |
getStaticFileLocation(VaadinRequest request)
Return the URL from where static files, e.g. |
SystemMessages |
getSystemMessages(java.util.Locale locale)
Gets the system message to use for a specific locale. |
SystemMessagesProvider |
getSystemMessagesProvider()
Gets the system messages provider currently defined for this service. |
abstract 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)
Check if the given UI should be associated with the window.name so that it can be re-used if the browser window
is reloaded. |
static void |
reinitializeSession(VaadinRequest request)
Discards the current session and creates a new session with the same contents. |
void |
removeSessionDestroyListener(SessionDestroyListener listener)
Removes a Vaadin service session destroy listener from this service. |
void |
removeSessionInitListener(SessionInitListener listener)
Removes a Vaadin service session initialization listener from this service. |
protected abstract boolean |
requestCanCreateSession(VaadinRequest request)
Checks whether it's valid to create a new service session as a result of the given request. |
void |
setAddonContext(AddonContext addonContext)
|
void |
setCurrentInstances(VaadinRequest request,
VaadinResponse response)
Sets the this Vaadin service as the current service and also sets the current Vaadin request and Vaadin response. |
void |
setSystemMessagesProvider(SystemMessagesProvider systemMessagesProvider)
Sets the system messages provider to use for getting system messages to display to users of this service. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
@Deprecated public static final java.lang.String URL_PARAMETER_RESTART_APPLICATION
LegacyApplication.@Deprecated public static final java.lang.String URL_PARAMETER_CLOSE_APPLICATION
LegacyApplication.| Constructor Detail |
|---|
public VaadinService(DeploymentConfiguration deploymentConfiguration)
deploymentConfiguration - the deployment configuration for the service| Method Detail |
|---|
public abstract java.lang.String getStaticFileLocation(VaadinRequest request)
request - the request for which the location should be determined
public abstract java.lang.String getConfiguredWidgetset(VaadinRequest request)
request - the request for which a widgetset is required
public abstract java.lang.String getConfiguredTheme(VaadinRequest request)
request - the request for which a theme is required
public abstract boolean isStandalone(VaadinRequest request)
request - the request for which the UI is loaded
public java.lang.ClassLoader getClassLoader()
null indicates that the default class
loader should be used.
nullpublic abstract java.lang.String getMimeType(java.lang.String resourceName)
resourceName - a String specifying the name of a file
ServletContext.getMimeType(String),
PortletContext.getMimeType(String)public DeploymentConfiguration getDeploymentConfiguration()
public java.util.Iterator<AddonContextListener> getAddonContextListeners()
public AddonContext getAddonContext()
public void setAddonContext(AddonContext addonContext)
public void setSystemMessagesProvider(SystemMessagesProvider systemMessagesProvider)
systemMessagesProvider - the system messages provider; null is not
allowed.getSystemMessagesProvider()public SystemMessagesProvider getSystemMessagesProvider()
By default, the DefaultSystemMessagesProvider which always
provides the built-in default SystemMessages is used.
nullsetSystemMessagesProvider(SystemMessagesProvider),
SystemMessagesProvider,
SystemMessagespublic SystemMessages getSystemMessages(java.util.Locale locale)
locale - the desired locale for the system messages
public abstract java.io.File getBaseDirectory()
public void addSessionInitListener(SessionInitListener listener)
Because of the way different service instances share the same session, the listener is not necessarily notified immediately when the session is created but only when the first request for that session is handled by this service.
listener - the Vaadin service session initialization listenerremoveSessionInitListener(SessionInitListener),
SessionInitListenerpublic void removeSessionInitListener(SessionInitListener listener)
listener - the Vaadin service session initialization listener to remove.addSessionInitListener(SessionInitListener)public void addSessionDestroyListener(SessionDestroyListener listener)
listener - the vaadin service session destroy listeneraddSessionInitListener(SessionInitListener)public void fireSessionDestroy(VaadinServiceSession vaadinSession)
public void removeSessionDestroyListener(SessionDestroyListener listener)
listener - the vaadin service session destroy listeneraddSessionDestroyListener(SessionDestroyListener)
public VaadinServiceSession findVaadinSession(VaadinRequest request)
throws ServiceException,
SessionExpiredException
request - the request to get a vaadin service session for.
null
if no session is found and this is a request for which a new
session shouldn't be created.
ServiceException
SessionExpiredExceptionVaadinServiceSession
@Deprecated
protected java.net.URL getApplicationUrl(VaadinRequest request)
throws java.net.MalformedURLException
LegacyApplication.
This is only used to support legacy cases.
request -
java.net.MalformedURLExceptionprotected abstract AbstractCommunicationManager createCommunicationManager(VaadinServiceSession session)
session - the service session for which a new communication manager is
needed
protected VaadinServiceSession createVaadinSession(VaadinRequest request)
throws ServiceException
request -
javax.servlet.ServletException
java.net.MalformedURLException
ServiceException
protected VaadinServiceSession getExistingSession(VaadinRequest request,
boolean allowSessionCreation)
throws SessionExpiredException
SessionExpiredExceptionprotected abstract boolean requestCanCreateSession(VaadinRequest request)
request - the request
true if it's valid to create a new service session
for the request; else falsepublic static VaadinService getCurrent()
InheritableThreadLocal). In other cases, (e.g. from background
threads started in some other way), the current service is not
automatically defined.
nullsetCurrentInstances(VaadinRequest, VaadinResponse)
public void setCurrentInstances(VaadinRequest request,
VaadinResponse response)
The application developer can also use this method to define the current instances outside the normal request handling, e.g. when initiating custom background threads.
request - the Vaadin request to set as the current request, or
null if no request should be set.response - the Vaadin response to set as the current response, or
null if no response should be set.getCurrent(),
getCurrentRequest(),
getCurrentResponse()public static VaadinRequest getCurrentRequest()
nullsetCurrentInstances(VaadinRequest, VaadinResponse)public static VaadinResponse getCurrentResponse()
nullsetCurrentInstances(VaadinRequest, VaadinResponse)public abstract java.lang.String getServiceName()
public UI findUI(VaadinRequest request)
UI that belongs to the provided request. This is
generally only supported for UIDL requests as other request types are not
related to any particular UI or have the UI information encoded in a
non-standard way. The returned UI is also set as the current UI (
UI.setCurrent(UI)).
request - the request for which a UI is desired
public boolean preserveUIOnRefresh(UIProvider provider,
UICreateEvent event)
window.name so that it can be re-used if the browser window
is reloaded. This is typically determined by the UI provider which
typically checks the @PreserveOnRefresh annotation but UI
providers and ultimately VaadinService implementations may choose to
override the defaults.
provider - the UI provider responsible for the UIevent - the UI create event with details about the UI
true if the UI should be preserved on refresh;
false if a new UI instance should be initialized on
refreshed.public static void reinitializeSession(VaadinRequest request)
Please note that this method makes certain assumptions about how data is stored in the underlying session and may thus not be compatible with some environments.
request - The Vaadin request for which the session should be
reinitialized
public abstract java.lang.String getMainDivId(VaadinServiceSession session,
VaadinRequest request,
java.lang.Class<? extends UI> uiClass)
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 bootstrapped
public void closeSession(VaadinServiceSession session)
SystemMessages.getOutOfSyncCaption()) error and a new session
will be created for serving new UIs.
To avoid causing out of sync errors, you should typically redirect to
some other page using Page.setLocation(String) to make the
browser unload the invalidated UI.
session - the session to close
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||