Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
In WebSphere Portal when coming back to Vaadin portlet the state is lost
Hi,
We found in WebSphere Portal that when you take an action that refreshes the Portal page, like going to another Tab and coming back, the Vaadin portlet re-initializes itself. We are using Portlet 1.0 functionality i.e. with the Vaadin Servlet.
It seemed the Application was recreated each time so after further investigation we found the following:
- PortletApplicationContext, method getApplicationContext, gets the WebApplicationContext from the session and, even if it doesn't change, adds it back to the session
- this gets interpreted as an unbound / bound by WebSphere container and
- triggers the javax.servlet.http.HttpSessionBindingListener#valueUnbound(HttpSessionBindingEvent) method on AbstractWebApplicationContext which
- closes all applications
We fixed it by adding a flag to both getApplicationContext methods
boolean newContext = false;
... set flag to true if context is changed ...
if (newContext == true) {
session.setAttribute(WebApplicationContext.class.getName(), cx,
PortletSession.APPLICATION_SCOPE);
}
and this solved our problem.
Question: why is PortletApplicationContext deprecated ? It is used by ApplicationPortlet which is not deprecated and which we subclass.