I’m new to portlet and Vaadin so I sorry in advance to stupid question.
My issue is tied to portlet context, my portlet implements com.vaadin.terminal.gwt.server.PortletApplicationContext2.PortletListener to listen some context changes.
When I try to subscribe portelt as listenener with the following code
java.lang.ClassCastException: com.vaadin.terminal.gwt.server.WebApplicationContext cannot be cast to com.vaadin.terminal.gwt.server.PortletApplicationContext2
You don’t configure the context used. If your portlet follows the Portlet 2.0 spec (JSR-286), the context is always a PortletApplicationContext2. If you are running a servlet, the context is always a WebApplicationContext. A Portlet 1.0 portlet (JSR-168) does have a servlet running “behind the scenes”.
See
the book for more information. The critical bits in portlet.xml are something like:
<portlet>
<portlet-name>Portlet Example portlet</portlet-name>
<display-name>Vaadin Portlet Example</display-name>
<portlet-class>
[b]
com.vaadin.terminal.gwt.server.ApplicationPortlet2
[/b]
</portlet-class>
<init-param>
<name>application</name>
<!-- The application class with package name. -->
<value>com.example.myportlet.MyportletApplication</value>
</init-param>