Four portlet issues with Liferay

Environment:
JDK 1.5.0_17
Liferay 5.2.3 Tomcat 6.0.18
Eclipse Galileo
Vaadin 6.1.3

  1. It’s important to add a note that it’s required to set the code level to 1.5, and in the project facets the level to 5. Otherwise portlets are not deployed

  2. I think there is some trick to use common widgetset. In fact the mail-portlet throws an exception due to it.

I’ve followed the instructions to share widgetset:
a. copy the WebContentVAADIN folder ro ROOT/WEB-INF/html/VAADIN
b. add propeties to portal-ext.properties:

# Path under which the VAADIN directory is located.
# (/html is the default so it is not needed.)
# vaadin.resources.path=/html

# Portal-wide widget set
vaadin.widgetset=com.vaadin.demo.sampler.gwt.SamplerWidgetSet

# Theme to use
vaadin.theme=reindeer

Then I created a new theme in the application. The portlet is modified to use that theme. The file styles.css contains

@import url(../reindeer/styles.css);
c. Uncommented in portlet.xml this parameter
       <init-param>
            <name>widgetset</name>
            <value>com.vaadin.portal.gwt.PortalDefaultWidgetSet</value>
        </init-param>

Whether you use or not that theme, the portal reports

I’m sure any portlet can use whatever theme derived from the common themes, or not derived, as needed. I suppose there is something missing because it cannot be true that every portlet must deploy it’s themes in a server-wide folder.

  1. In the book says the portlet.jar must be added to the war, but not in the WEB-INF/lib folder. I haven’t added such jar and portlet works. I think the explanation is incomplete or invalid and should be rewritten.

  2. the recommended way to deploy Vaadin portlets is to use a shared copy of vaadin.jar. The book says the file vaadin.x.x.x.jar in WEB-INF/lib folder must be excluded before deployment. I’ve deployed vaadin.jar in WEB-INF/lib and erased it from the war. It works. What I don’t know is how to configure Eclipse for the jar not be included in the exported war

Thanks
Aniceto

This is already mentioned in
Developing Vaadin Applications as Liferay Portlets
:

There are two ways to deploy a portlet: with shared resources (recommended) or completely stand-alone.

If using shared resources, you should not use the parameter in portlet.xml - the widgetset will be determined based on the shared configuration.

Currently, you should not remove the resource path entry as the semantics of the other parameters does change somewhat based on whether it is present or not, even if the default value would be correct.

Only the base theme defined in portal-ext.properties (and the widgetset) is loaded from the shared resource folder. All portlet specific themes are loaded from the portlet itself.

If I remember correctly, that JAR should be on the build path of the Eclipse project (at least if you use any portal/portlet specific features) but does not need to go to the WAR. Maybe someone can confirm or correct this?

If you do have the JAR in WEB-INF/lib, you risk version conflicts if the shared Vaadin library and/or widgetset does not match the version in the portlet. In addition, your portlet will be bigger than necessary.

One way to do this is to create a /lib directory in the portlet, move Vaadin JAR to it and use it on the project build path. Then, it is easy to exclude it from the WAR.

Henri

One additional point:

This import is unnecessary if the shared theme is configured properly: the shared theme is loaded in any case once per page. However, you might want to keep the import to be able to debug the portlet also as a servlet.

If running the portlet also as a servlet while debugging, make sure you clear any browser session cookies between running it as a servlet and as a portlet. Otherwise, you are likely to run into synchronization problems (wrong security key).

About setting code to 1.5 level:


Henri Sara

[quote]
This is already mentioned in Developing Vaadin Applications as Liferay Portlets:

[/quote]Yes, in the middle of a tutotial, but not in the Vaadin book. Videos don’t mention it. And the Vaadit book says Vaadin has special support for Liferay portlets.

[quote]
While providing generic support for all portals implementing the standard, Vaadin especially supports the Liferay portal and the needed portal-specific configuration is given below for Liferay.
[/quote]It’s not a hard task to mention it there. In summary, two hours lost.

About the shared vaadin jar:


Henri Sara

Eclipse includes it automatically, I suppose due to a project facet. It is not in the Java EE Dependencies any checkbox to exclude it from war. I’m not an Eclipse expert, in fact I hate it. So I asked for the steps to exclude it from the war.