com.vaadin.server
Class VaadinPortletSession

java.lang.Object
  extended by com.vaadin.server.VaadinSession
      extended by com.vaadin.server.VaadinPortletSession
All Implemented Interfaces:
java.io.Serializable, java.util.EventListener, javax.servlet.http.HttpSessionBindingListener

public class VaadinPortletSession
extends VaadinSession

An implementation of VaadinSession for JSR-286 portlet environments. This is automatically registered as a HttpSessionBindingListener when PortletSession#setAttribute() is called with the context as value. Only the documented parts of this class should be considered as stable public API. Note also that some methods and/or nested interfaces might move to VaadinPortletService in future minor or major versions of Vaadin. In these cases, a deprecated redirection for backwards compatibility will be used in VaadinPortletSession for a transition period.

Since:
7.0
See Also:
Serialized Form

Nested Class Summary
static interface VaadinPortletSession.PortletListener
          Listener interface for the various types of JSR-286 portlet requests.
 
Nested classes/interfaces inherited from class com.vaadin.server.VaadinSession
VaadinSession.FutureAccess, VaadinSession.State
 
Field Summary
 
Fields inherited from class com.vaadin.server.VaadinSession
browser, UI_PARAMETER
 
Constructor Summary
VaadinPortletSession(VaadinPortletService service)
          Create a portlet service session for the given portlet service
 
Method Summary
 void addPortletListener(VaadinPortletSession.PortletListener listener)
          Adds a listener for various types of portlet requests.
 void firePortletActionRequest(UI uI, javax.portlet.ActionRequest request, javax.portlet.ActionResponse response)
          For internal use by the framework only - API subject to change.
 void firePortletEventRequest(UI uI, javax.portlet.EventRequest request, javax.portlet.EventResponse response)
          For internal use by the framework only - API subject to change.
 void firePortletRenderRequest(UI uI, javax.portlet.RenderRequest request, javax.portlet.RenderResponse response)
          For internal use by the framework only - API subject to change.
 void firePortletResourceRequest(UI uI, javax.portlet.ResourceRequest request, javax.portlet.ResourceResponse response)
          For internal use by the framework only - API subject to change.
 javax.portlet.PortletURL generateActionURL(java.lang.String action)
          Creates a new action URL.
 javax.portlet.PortletConfig getPortletConfig()
          Returns the JSR-286 portlet configuration that provides access to the portlet context and init parameters.
 javax.portlet.PortletSession getPortletSession()
          Returns the underlying portlet session.
 void removePortletListener(VaadinPortletSession.PortletListener listener)
          Removes a portlet request listener registered with addPortletListener(PortletListener).
 void sendPortletEvent(UI uI, javax.xml.namespace.QName name, java.io.Serializable value)
          Sends a portlet event to the indicated destination.
 void setPortletMode(UI uI, javax.portlet.PortletMode portletMode)
          Sets the portlet mode.
 void setSharedRenderParameter(UI uI, java.lang.String name, java.lang.String value)
          Sets a shared portlet parameter.
 
Methods inherited from class com.vaadin.server.VaadinSession
access, accessSynchronously, addBootstrapListener, addRequestHandler, addUI, addUIProvider, close, createConnectorId, getAllSessions, getAttribute, getAttribute, getBrowser, getCommunicationManager, getConfiguration, getConverterFactory, getCsrfToken, getCumulativeRequestDuration, getCurrent, getDragAndDropService, getErrorHandler, getForSession, getGlobalResourceHandler, getLastRequestDuration, getLastRequestTimestamp, getLocale, getLockInstance, getNextUIid, getPendingAccessQueue, getRequestHandlers, getService, getSession, getState, getUIByEmbedId, getUIById, getUIProviders, getUIs, hasLock, hasLock, isClosing, lock, modifyBootstrapResponse, refreshTransients, removeBootstrapListener, removeFromSession, removeRequestHandler, removeUI, removeUIProvider, setAttribute, setAttribute, setCommunicationManager, setConfiguration, setConverterFactory, setCurrent, setErrorHandler, setLastRequestDuration, setLastRequestTimestamp, setLocale, setState, storeInSession, unlock, valueBound, valueUnbound
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VaadinPortletSession

public VaadinPortletSession(VaadinPortletService service)
Create a portlet service session for the given portlet service

Parameters:
service - the portlet service to which the new session belongs
Method Detail

getPortletSession

public javax.portlet.PortletSession getPortletSession()
Returns the underlying portlet session.

Returns:
portlet session

getPortletConfig

public javax.portlet.PortletConfig getPortletConfig()
Returns the JSR-286 portlet configuration that provides access to the portlet context and init parameters.

Returns:
portlet configuration

addPortletListener

public void addPortletListener(VaadinPortletSession.PortletListener listener)
Adds a listener for various types of portlet requests.

Parameters:
listener - to add

removePortletListener

public void removePortletListener(VaadinPortletSession.PortletListener listener)
Removes a portlet request listener registered with addPortletListener(PortletListener).

Parameters:
listener - to remove

firePortletRenderRequest

public void firePortletRenderRequest(UI uI,
                                     javax.portlet.RenderRequest request,
                                     javax.portlet.RenderResponse response)
For internal use by the framework only - API subject to change.


firePortletActionRequest

public void firePortletActionRequest(UI uI,
                                     javax.portlet.ActionRequest request,
                                     javax.portlet.ActionResponse response)
For internal use by the framework only - API subject to change.


firePortletEventRequest

public void firePortletEventRequest(UI uI,
                                    javax.portlet.EventRequest request,
                                    javax.portlet.EventResponse response)
For internal use by the framework only - API subject to change.


firePortletResourceRequest

public void firePortletResourceRequest(UI uI,
                                       javax.portlet.ResourceRequest request,
                                       javax.portlet.ResourceResponse response)
For internal use by the framework only - API subject to change.


generateActionURL

public javax.portlet.PortletURL generateActionURL(java.lang.String action)
Creates a new action URL. Creating an action URL is only supported when processing a suitable request (render or resource request, including normal Vaadin UIDL processing) and will return null if not processing a suitable request.

Parameters:
action - the action parameter (javax.portlet.action parameter value in JSR-286)
Returns:
action URL or null if called outside a MimeRequest (outside a UIDL request or similar)

sendPortletEvent

public void sendPortletEvent(UI uI,
                             javax.xml.namespace.QName name,
                             java.io.Serializable value)
                      throws java.lang.IllegalStateException
Sends a portlet event to the indicated destination. Internally, an action may be created and opened, as an event cannot be sent directly from all types of requests. Sending portlet events from background threads is not supported. The event destinations and values need to be kept in the context until sent. Any memory leaks if the action fails are limited to the session. Event names for events sent and received by a portlet need to be declared in portlet.xml .

Parameters:
uI - a window in which a temporary action URL can be opened if necessary
name - event name
value - event value object that is Serializable and, if appropriate, has a valid JAXB annotation
Throws:
java.lang.IllegalStateException

setSharedRenderParameter

public void setSharedRenderParameter(UI uI,
                                     java.lang.String name,
                                     java.lang.String value)
                              throws java.lang.IllegalStateException
Sets a shared portlet parameter. Internally, an action may be created and opened, as shared parameters cannot be set directly from all types of requests. Setting shared render parameters from background threads is not supported. The parameters and values need to be kept in the context until sent. Any memory leaks if the action fails are limited to the session. Shared parameters set or read by a portlet need to be declared in portlet.xml .

Parameters:
uI - a window in which a temporary action URL can be opened if necessary
name - parameter identifier
value - parameter value
Throws:
java.lang.IllegalStateException

setPortletMode

public void setPortletMode(UI uI,
                           javax.portlet.PortletMode portletMode)
                    throws java.lang.IllegalStateException,
                           javax.portlet.PortletModeException
Sets the portlet mode. This may trigger a new render request. Currently, this is only supported when working with a StateAwareResponse (an action request or an event request). Portlet mode change in background threads is not supported. Portlet modes used by a portlet need to be declared in portlet.xml .

Parameters:
uI - a window in which the render URL can be opened if necessary
portletMode - the portlet mode to switch to
Throws:
javax.portlet.PortletModeException - if the portlet mode is not allowed for some reason (configuration, permissions etc.)
java.lang.IllegalStateException - if not processing a request of the correct type


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