com.vaadin.server
Class VaadinPortletService

java.lang.Object
  extended by com.vaadin.server.VaadinService
      extended by com.vaadin.server.VaadinPortletService
All Implemented Interfaces:
java.io.Serializable

public class VaadinPortletService
extends VaadinService

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.vaadin.server.VaadinService
URL_PARAMETER_CLOSE_APPLICATION, URL_PARAMETER_RESTART_APPLICATION
 
Constructor Summary
VaadinPortletService(VaadinPortlet portlet, DeploymentConfiguration deploymentConfiguration)
           
 
Method Summary
protected  java.util.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
 java.io.File getBaseDirectory()
          Returns the context base directory.
 java.lang.String getConfiguredTheme(VaadinRequest request)
          Gets the theme that is configured for this deployment, e.g.
 java.lang.String getConfiguredWidgetset(VaadinRequest request)
          Gets the widgetset that is configured for this deployment, e.g.
static javax.portlet.PortletRequest getCurrentPortletRequest()
           
static VaadinPortletResponse getCurrentResponse()
           
 java.lang.String getMainDivId(VaadinSession 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.
 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.
 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
 java.lang.String getServiceName()
          Gets a unique name for this service.
 java.lang.String getStaticFileLocation(VaadinRequest request)
          Return the URL from where static files, e.g.
 java.io.InputStream getThemeResourceAsStream(UI uI, java.lang.String themeName, java.lang.String resource)
          TODO PUSH Document TODO Pass UI or VaadinSession?
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  boolean requestCanCreateSession(VaadinRequest request)
          Checks whether it's valid to create a new service session as a result of the given request.
 
Methods inherited from class com.vaadin.server.VaadinService
accessSession, addSessionDestroyListener, addSessionInitListener, closeSession, createCriticalNotificationJSON, criticalNotification, ensureAccessQueuePurged, ensurePushAvailable, findUI, findVaadinSession, fireSessionDestroy, getApplicationUrl, getClassLoader, getCurrent, getCurrentRequest, getDeploymentConfiguration, getExistingSession, getRequestHandlers, getSessionLock, getSystemMessages, getSystemMessagesProvider, handleRequest, init, isCsrfTokenValid, lockSession, reinitializeSession, removeSessionDestroyListener, removeSessionInitListener, requestEnd, requestStart, runPendingAccessTasks, setClassLoader, setCurrent, setCurrentInstances, setSystemMessagesProvider, unlockSession, verifyNoOtherSessionLocked, writeStringResponse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VaadinPortletService

public VaadinPortletService(VaadinPortlet portlet,
                            DeploymentConfiguration deploymentConfiguration)
                     throws ServiceException
Throws:
ServiceException
Method Detail

createRequestHandlers

protected java.util.List<RequestHandler> createRequestHandlers()
                                                        throws ServiceException
Description copied from class: VaadinService
Called during initialization to add the request handlers for the service. Note that the returned list will be reversed so the last handler will be called first. This enables overriding this method and using add on the returned list to add a custom request handler which overrides any predefined handler.

Overrides:
createRequestHandlers in class VaadinService
Returns:
The list of request handlers used by this service.
Throws:
ServiceException - if a problem occurs when creating the request handlers

getPortlet

public VaadinPortlet getPortlet()
Retrieves a reference to the portlet associated with this service.

Returns:
A reference to the VaadinPortlet this service is using

getConfiguredWidgetset

public java.lang.String getConfiguredWidgetset(VaadinRequest request)
Description copied from class: VaadinService
Gets the widgetset that is configured for this deployment, e.g. from a parameter in web.xml.

Specified by:
getConfiguredWidgetset in class VaadinService
Parameters:
request - the request for which a widgetset is required
Returns:
the name of the widgetset

getConfiguredTheme

public java.lang.String getConfiguredTheme(VaadinRequest request)
Description copied from class: VaadinService
Gets the theme that is configured for this deployment, e.g. from a portal parameter or just some sensible default value.

Specified by:
getConfiguredTheme in class VaadinService
Parameters:
request - the request for which a theme is required
Returns:
the name of the theme

isStandalone

public boolean isStandalone(VaadinRequest request)
Description copied from class: VaadinService
Checks whether the UI will be rendered on its own in the browser or whether it will be included into some other context. A standalone UI may do things that might interfere with other parts of a page, e.g. changing the page title and requesting focus upon loading.

Specified by:
isStandalone in class VaadinService
Parameters:
request - the request for which the UI is loaded
Returns:
a boolean indicating whether the UI should be standalone

getStaticFileLocation

public java.lang.String getStaticFileLocation(VaadinRequest request)
Description copied from class: VaadinService
Return the URL from where static files, e.g. the widgetset and the theme, are served. In a standard configuration the VAADIN folder inside the returned folder is what is used for widgetsets and themes. The returned folder is usually the same as the context path and independent of e.g. the servlet mapping.

Specified by:
getStaticFileLocation in class VaadinService
Parameters:
request - the request for which the location should be determined
Returns:
The location of static resources (should contain the VAADIN directory). Never ends with a slash (/).

getMimeType

public java.lang.String getMimeType(java.lang.String resourceName)
Description copied from class: VaadinService
Returns the MIME type of the specified file, or null if the MIME type is not known. The MIME type is determined by the configuration of the container, and may be specified in a deployment descriptor. Common MIME types are "text/html" and "image/gif".

Specified by:
getMimeType in class VaadinService
Parameters:
resourceName - a String specifying the name of a file
Returns:
a String specifying the file's MIME type
See Also:
ServletContext.getMimeType(String), PortletContext.getMimeType(String)

getBaseDirectory

public java.io.File getBaseDirectory()
Description copied from class: VaadinService
Returns the context base directory. Typically an application is deployed in a such way that is has an application directory. For web applications this directory is the root directory of the web applications. In some cases applications might not have an application directory (for example web applications running inside a war).

Specified by:
getBaseDirectory in class VaadinService
Returns:
The application base directory or null if the application has no base directory.

requestCanCreateSession

protected boolean requestCanCreateSession(VaadinRequest request)
Description copied from class: VaadinService
Checks whether it's valid to create a new service session as a result of the given request.

Specified by:
requestCanCreateSession in class VaadinService
Parameters:
request - the request
Returns:
true if it's valid to create a new service session for the request; else false

getRequestType

@Deprecated
protected VaadinPortlet.RequestType getRequestType(VaadinRequest request)
Deprecated. As of 7.0. Will likely change or be removed in a future version

Gets the request type for the request.

Parameters:
request - the request to get a request type for
Returns:
the request type

getCurrentPortletRequest

public static javax.portlet.PortletRequest getCurrentPortletRequest()

getCurrentResponse

public static VaadinPortletResponse getCurrentResponse()

createVaadinSession

protected VaadinSession createVaadinSession(VaadinRequest request)
                                     throws ServiceException
Description copied from class: VaadinService
Creates a new Vaadin session for this service and request

Overrides:
createVaadinSession in class VaadinService
Parameters:
request - The request for which to create a VaadinSession
Returns:
A new VaadinSession
Throws:
ServiceException

getServiceName

public java.lang.String getServiceName()
Description copied from class: VaadinService
Gets a unique name for this service. The name should be unique among different services of the same type but the same for corresponding instances running in different JVMs in a cluster. This is typically based on e.g. the configured servlet's or portlet's name.

Specified by:
getServiceName in class VaadinService
Returns:
the unique name of this service instance.

preserveUIOnRefresh

public boolean preserveUIOnRefresh(UIProvider provider,
                                   UICreateEvent event)
Always preserve UIs in portlets to make portlet actions work.

Overrides:
preserveUIOnRefresh in class VaadinService
Parameters:
provider - the UI provider responsible for the UI
event - the UI create event with details about the UI
Returns:
true if the UI should be preserved on refresh; false if a new UI instance should be initialized on refreshed.

getThemeResourceAsStream

public java.io.InputStream getThemeResourceAsStream(UI uI,
                                                    java.lang.String themeName,
                                                    java.lang.String resource)
Description copied from class: VaadinService
TODO PUSH Document TODO Pass UI or VaadinSession?

Specified by:
getThemeResourceAsStream in class VaadinService
Returns:

getMainDivId

public java.lang.String getMainDivId(VaadinSession session,
                                     VaadinRequest request,
                                     java.lang.Class<? extends UI> uiClass)
Description copied from class: VaadinService
Creates and returns a unique ID for the DIV where the UI is to be rendered.

Specified by:
getMainDivId in class VaadinService
Parameters:
session - The service session to which the bootstrapped UI will belong.
request - The request for which a div id is needed
uiClass - The class of the UI that will be bootstrapped
Returns:
the id to use in the DOM

handleSessionExpired

protected void handleSessionExpired(VaadinRequest request,
                                    VaadinResponse response)
Description copied from class: VaadinService
Called when the session has expired and the request handling is therefore aborted.

Overrides:
handleSessionExpired in class VaadinService
Parameters:
request - The request
response - The response


Copyright © 2000-2011 Vaadin Ltd. All Rights Reserved.