|
||||||||||
| 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.
| Nested Class Summary | |
|---|---|
static class |
VaadinService.VaadinServiceData
Service specific data that is stored in VaadinSession separately for each VaadinService using that particular session. |
| 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 session that has been initialized for this service is destroyed. |
void |
addSessionInitListener(SessionInitListener listener)
Adds a listener that gets notified when a new Vaadin session is initialized for this service. |
void |
addUIProvider(VaadinSession vaadinSession,
UIProvider uiProvider)
Adds a UI provider to a Vaadin session and associates it with this Vaadin service. |
protected abstract AbstractCommunicationManager |
createCommunicationManager(VaadinSession session)
Create a communication manager to use for the given Vaadin session. |
protected abstract VaadinSession |
createVaadinSession(VaadinRequest request)
Creates a new vaadin session. |
UI |
findUI(VaadinRequest request)
Finds the UI that belongs to the provided request. |
VaadinSession |
findVaadinSession(VaadinRequest request)
Attempts to find a Vaadin session associated with this request. |
void |
fireSessionDestroy(VaadinSession 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 VaadinSession |
getExistingSession(VaadinRequest request,
boolean allowSessionCreation)
|
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. |
abstract SystemMessages |
getSystemMessages()
Gets the system messages object |
java.util.List<UIProvider> |
getUIProviders(VaadinSession session)
Gets all the UI providers from a session that are configured 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. |
void |
removeSessionDestroyListener(SessionDestroyListener listener)
Removes a Vaadin session destroy listener from this service. |
void |
removeSessionInitListener(SessionInitListener listener)
Removes a Vaadin session initialization listener from this service. |
void |
removeUIProvider(VaadinSession vaadinSession,
UIProvider uiProvider)
Removes a UI provider association for this service from a Vaadin session. |
protected abstract boolean |
requestCanCreateSession(VaadinRequest request)
Checks whether it's valid to create a new Vaadin 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. |
| 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 abstract SystemMessages getSystemMessages()
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 session initialization listenerremoveSessionInitListener(SessionInitListener),
SessionInitListenerpublic void removeSessionInitListener(SessionInitListener listener)
listener - the Vaadin session initialization listener to remove.addSessionInitListener(SessionInitListener)public void addSessionDestroyListener(SessionDestroyListener listener)
listener - the vaadin session destroy listeneraddSessionInitListener(SessionInitListener)public void fireSessionDestroy(VaadinSession vaadinSession)
public void removeSessionDestroyListener(SessionDestroyListener listener)
listener - the vaadin session destroy listeneraddSessionDestroyListener(SessionDestroyListener)
public VaadinSession findVaadinSession(VaadinRequest request)
throws ServiceException,
SessionExpiredException
request - the request to get a vaadin session for.
null if no
session is found and this is a request for which a new session
shouldn't be created.
ServiceException
SessionExpiredExceptionVaadinSession
@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(VaadinSession session)
session - the vaadin session for which a new communication manager is
needed
protected abstract VaadinSession createVaadinSession(VaadinRequest request)
throws ServiceException
request -
javax.servlet.ServletException
java.net.MalformedURLException
ServiceException
protected VaadinSession 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 Vaadin 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 java.util.List<UIProvider> getUIProviders(VaadinSession session)
session - the Vaadin session to get the UI providers from
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 void addUIProvider(VaadinSession vaadinSession,
UIProvider uiProvider)
vaadinSession - the Vaadin session to store the UI provider inuiProvider - the UI provider that should be added
public void removeUIProvider(VaadinSession vaadinSession,
UIProvider uiProvider)
vaadinSession - the Vaadin session where the UI provider is storeduiProvider - the UI provider that should be removed
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.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||