com.vaadin.terminal.gwt.server.
Class PortletApplicationContext2
java.lang.Object
com.vaadin.terminal.gwt.server.AbstractWebApplicationContext
com.vaadin.terminal.gwt.server.PortletApplicationContext2
All Implemented Interfaces:
ApplicationContext, Serializable, EventListener, HttpSessionBindingListener
- extends AbstractWebApplicationContext
public class PortletApplicationContext2
TODO Write documentation, fix JavaDoc tags.
This is automatically registered as a HttpSessionBindingListener
when
PortletSession#setAttribute()
is called with the context as value.
Author:
peholmst
See Also:
Nested Class Summary | |
---|---|
static interface |
PortletApplicationContext2.PortletListener
|
Nested classes/interfaces inherited from interface com.vaadin.service.ApplicationContext |
---|
ApplicationContext.TransactionListener |
Field Summary | |
---|---|
protected javax.portlet.PortletConfig |
portletConfig
|
protected Map<Application,Set<PortletApplicationContext2.PortletListener>> |
portletListeners
|
protected HashMap<String,Application> |
portletWindowIdToApplicationMap
|
protected javax.portlet.PortletSession |
session
|
Fields inherited from class com.vaadin.terminal.gwt.server.AbstractWebApplicationContext |
---|
applications, applicationToAjaxAppMgrMap, browser, listeners |
Constructor Summary | |
---|---|
PortletApplicationContext2()
|
Method Summary | |
---|---|
protected void |
addApplication(Application application,
String portletWindowId)
|
void |
addPortletListener(Application app,
PortletApplicationContext2.PortletListener listener)
|
protected PortletCommunicationManager |
createPortletCommunicationManager(Application application)
|
void |
firePortletActionRequest(Application app,
Window window,
javax.portlet.ActionRequest request,
javax.portlet.ActionResponse response)
|
void |
firePortletEventRequest(Application app,
Window window,
javax.portlet.EventRequest request,
javax.portlet.EventResponse response)
|
void |
firePortletRenderRequest(Application app,
Window window,
javax.portlet.RenderRequest request,
javax.portlet.RenderResponse response)
|
void |
firePortletResourceRequest(Application app,
Window window,
javax.portlet.ResourceRequest request,
javax.portlet.ResourceResponse response)
|
javax.portlet.PortletURL |
generateActionURL(String action)
Creates a new action URL. |
String |
generateApplicationResourceURL(ApplicationResource resource,
String mapKey)
Generate a URL that can be used as the relative location of e.g. |
static PortletApplicationContext2 |
getApplicationContext(javax.portlet.PortletSession session)
|
Application |
getApplicationForWindowId(String portletWindowId)
|
protected PortletCommunicationManager |
getApplicationManager(Application application)
|
File |
getBaseDirectory()
Returns application context base directory. |
javax.portlet.PortletConfig |
getPortletConfig()
|
javax.portlet.PortletSession |
getPortletSession()
|
boolean |
isProductionMode()
|
protected void |
removeApplication(Application application)
|
void |
removePortletListener(Application app,
PortletApplicationContext2.PortletListener listener)
|
void |
sendPortletEvent(Window window,
QName name,
Serializable value)
Sends a portlet event to the indicated destination. |
void |
setPortletConfig(javax.portlet.PortletConfig config)
|
void |
setPortletMode(Window window,
javax.portlet.PortletMode portletMode)
Sets the portlet mode. |
void |
setProductionMode(boolean productionMode)
|
void |
setSharedRenderParameter(Window window,
String name,
String value)
Sets a shared portlet parameter. |
Methods inherited from class com.vaadin.terminal.gwt.server.AbstractWebApplicationContext |
---|
addTransactionListener, endTransaction, getApplications, getBrowser, getLastRequestTime, getTotalSessionTime, getURLKey, isApplicationResourceURL, removeTransactionListener, setLastRequestTime, startTransaction, valueBound, valueUnbound |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
portletListeners
protected Map<Application,Set<PortletApplicationContext2.PortletListener>> portletListeners
session
protected transient javax.portlet.PortletSession session
portletConfig
protected transient javax.portlet.PortletConfig portletConfig
portletWindowIdToApplicationMap
protected HashMap<String,Application> portletWindowIdToApplicationMap
Constructor Detail |
---|
PortletApplicationContext2
public PortletApplicationContext2()
Method Detail |
---|
getBaseDirectory
public File getBaseDirectory()
- Returns:
- The application base directory or null if the application has no base directory.
Description copied from interface: ApplicationContext
Returns application 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).
getApplicationManager
protected PortletCommunicationManager getApplicationManager(Application application)
createPortletCommunicationManager
protected PortletCommunicationManager createPortletCommunicationManager(Application application)
getApplicationContext
public static PortletApplicationContext2 getApplicationContext(javax.portlet.PortletSession session)
removeApplication
protected void removeApplication(Application application)
- Overrides:
removeApplication
in classAbstractWebApplicationContext
addApplication
protected void addApplication(Application application,
String portletWindowId)
getApplicationForWindowId
public Application getApplicationForWindowId(String portletWindowId)
getPortletSession
public javax.portlet.PortletSession getPortletSession()
getPortletConfig
public javax.portlet.PortletConfig getPortletConfig()
setPortletConfig
public void setPortletConfig(javax.portlet.PortletConfig config)
addPortletListener
public void addPortletListener(Application app,
PortletApplicationContext2.PortletListener listener)
removePortletListener
public void removePortletListener(Application app,
PortletApplicationContext2.PortletListener listener)
firePortletRenderRequest
public void firePortletRenderRequest(Application app,
Window window,
javax.portlet.RenderRequest request,
javax.portlet.RenderResponse response)
firePortletActionRequest
public void firePortletActionRequest(Application app,
Window window,
javax.portlet.ActionRequest request,
javax.portlet.ActionResponse response)
firePortletEventRequest
public void firePortletEventRequest(Application app,
Window window,
javax.portlet.EventRequest request,
javax.portlet.EventResponse response)
firePortletResourceRequest
public void firePortletResourceRequest(Application app,
Window window,
javax.portlet.ResourceRequest request,
javax.portlet.ResourceResponse response)
generateApplicationResourceURL
public String generateApplicationResourceURL(ApplicationResource resource,
String mapKey)
- Specified by:
generateApplicationResourceURL
in interfaceApplicationContext
- Overrides:
generateApplicationResourceURL
in classAbstractWebApplicationContext
mapKey
- a key for the resource that can later be extracted from a URL withApplicationContext.getURLKey(URL, String)
Description copied from interface: ApplicationContext
Generate a URL that can be used as the relative location of e.g. an
ApplicationResource
.
This method should only be called from the processing of a UIDL request,
not from a background thread. The return value is null if used outside a
suitable request.
generateActionURL
public javax.portlet.PortletURL generateActionURL(String action)
- Parameters:
action
-- Returns:
- action URL or null if called outside a MimeRequest (outside a UIDL request or similar)
Creates a new action URL.
sendPortletEvent
public void sendPortletEvent(Window window,
QName name,
Serializable value)
throws IllegalStateException
- Parameters:
window
- 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
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. 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 .
setSharedRenderParameter
public void setSharedRenderParameter(Window window,
String name,
String value)
throws IllegalStateException
- Parameters:
window
- a window in which a temporary action URL can be opened if necessaryname
- parameter identifiervalue
- parameter 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. 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 .
setPortletMode
public void setPortletMode(Window window,
javax.portlet.PortletMode portletMode)
throws IllegalStateException,
javax.portlet.PortletModeException
- Parameters:
window
- 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
Sets the portlet mode. This may trigger a new render request. Portlet modes used by a portlet need to be declared in portlet.xml .
isProductionMode
public boolean isProductionMode()
setProductionMode
public void setProductionMode(boolean productionMode)