Package com.vaadin.server
Class VaadinPortletSession
- java.lang.Object
-
- com.vaadin.server.VaadinSession
-
- com.vaadin.server.VaadinPortletSession
-
- All Implemented Interfaces:
Serializable,EventListener,javax.servlet.http.HttpSessionBindingListener
public class VaadinPortletSession extends VaadinSession
An implementation ofVaadinSessionfor JSR-286 portlet environments. This is automatically registered as aHttpSessionBindingListenerwhenPortletSession#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 toVaadinPortletServicein 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
Nested Classes Modifier and Type Class Description static interfaceVaadinPortletSession.PortletListenerListener 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, UI_PRIORITY_PARAMETER
-
-
Constructor Summary
Constructors Constructor Description VaadinPortletSession(VaadinPortletService service)Create a portlet service session for the given portlet service
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPortletListener(VaadinPortletSession.PortletListener listener)Adds a listener for various types of portlet requests.voidfirePortletActionRequest(UI uI, javax.portlet.ActionRequest request, javax.portlet.ActionResponse response)For internal use by the framework only - API subject to change.voidfirePortletEventRequest(UI uI, javax.portlet.EventRequest request, javax.portlet.EventResponse response)For internal use by the framework only - API subject to change.voidfirePortletRenderRequest(UI uI, javax.portlet.RenderRequest request, javax.portlet.RenderResponse response)For internal use by the framework only - API subject to change.voidfirePortletResourceRequest(UI uI, javax.portlet.ResourceRequest request, javax.portlet.ResourceResponse response)For internal use by the framework only - API subject to change.javax.portlet.PortletURLgenerateActionURL(String action)Creates a new action URL.javax.portlet.PortletConfiggetPortletConfig()Returns the JSR-286 portlet configuration that provides access to the portlet context and init parameters.javax.portlet.PortletSessiongetPortletSession()Returns the underlying portlet session.voidremovePortletListener(VaadinPortletSession.PortletListener listener)Removes a portlet request listener registered withaddPortletListener(PortletListener).voidsendPortletEvent(UI uI, QName name, Serializable value)Sends a portlet event to the indicated destination.voidsetPortletMode(UI uI, javax.portlet.PortletMode portletMode)Sets the portlet mode.voidsetSharedRenderParameter(UI uI, String name, String value)Sets a shared portlet parameter.-
Methods inherited from class com.vaadin.server.VaadinSession
access, accessSynchronously, addBootstrapListener, addRequestHandler, addUI, addUIProvider, addUIProvider, close, createConnectorId, getAllSessions, getAttribute, getAttribute, getBrowser, getCommunicationManager, getConfiguration, getConverterFactory, getCsrfToken, getCumulativeRequestDuration, getCurrent, getDragAndDropService, getErrorHandler, getForSession, getGlobalResourceHandler, getLastRequestDuration, getLastRequestTimestamp, getLocale, getLockInstance, getNextUIid, getPendingAccessQueue, getPushId, getRequestHandlers, getService, getSession, getState, getUIByEmbedId, getUIById, getUIProviderPriority, getUIProviders, getUIs, hasLock, hasLock, isClosing, lock, modifyBootstrapResponse, refreshTransients, removeBootstrapListener, removeFromSession, removeRequestHandler, removeUI, removeUIProvider, setAttribute, setAttribute, setCommunicationManager, setConfiguration, setConverterFactory, setCurrent, setErrorHandler, setLastRequestDuration, setLastRequestTimestamp, setLocale, setState, setUIProviderPriority, storeInSession, unlock, valueBound, valueUnbound
-
-
-
-
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 withaddPortletListener(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(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, QName name, Serializable value) throws 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 necessaryname- event namevalue- event value object that is Serializable and, if appropriate, has a valid JAXB annotation- Throws:
IllegalStateException
-
setSharedRenderParameter
public void setSharedRenderParameter(UI uI, String name, String value) throws 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 necessaryname- parameter identifiervalue- parameter value- Throws:
IllegalStateException
-
setPortletMode
public void setPortletMode(UI uI, javax.portlet.PortletMode portletMode) throws IllegalStateException, javax.portlet.PortletModeException
Sets the portlet mode. This may trigger a new render request. Currently, this is only supported when working with aStateAwareResponse(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 necessaryportletMode- the portlet mode to switch to- Throws:
javax.portlet.PortletModeException- if the portlet mode is not allowed for some reason (configuration, permissions etc.)IllegalStateException- if not processing a request of the correct type
-
-