I am running liferay on tomcat and trying to grab some custom session variables using a vaadin application, the below example grabs the screenname which works perfectly well when running the the liferay portal servlet under the ROOT context and based on the PortletDemo example.
In the init()
if (getContext() instanceof PortletApplicationContext) {
PortletApplicationContext ctx = (PortletApplicationContext) getContext();
ctx.addPortletListener(this, new DemoPortletListener());
} else {
getMainWindow().showNotification("Not inited via Portal!",
Notification.TYPE_ERROR_MESSAGE);
}
With this PortletListener
private class DemoPortletListener implements PortletListener {
@SuppressWarnings("unchecked")
public void handleRenderRequest(RenderRequest request,
RenderResponse response) {
// Get Liferay ScreenName
PortletSession psession= request.getPortletSession();
String ScreenName = (String) psession.getAttribute("screenname", PortletSession.APPLICATION_SCOPE);
SName.setValue(ScreenName);
}
}
In production I want to run it under another context such as /portal and I can not get this working.
I installed the vaadin.jar and added the themes and widgets to the portal-ext.properties file as below and changing the path of the vaadin.resources, this stopped the widget errors I was initially getting so I assume the portlet can access widgets and themes correctly with this setup:
vaadin.resources.path=/portal/html
vaadin.widgetset=com.vaadin.portal.gwt.PortalDefaultWidgetSet
vaadin.theme=reindeer
The problem I have is that when running liferay under /portal the listener does not seem to be initiated correctly. Can anybody help here. Thanks