Open mshabarov opened 2 years ago
The issue was triaged and currently added to the backlog priority queue for further investigation
Running Liferay with -Dvaadin.disable.automatic.servlet.registration=true
helps to get rid of some extra noise like reported in #222 when Push is disabled. Verified with simple test cases in main branch with Vaadin 23.3. Vaadin 14 has the same property so it should help with Vaadin portlet version 1.0.0 too.
Findings regarding enabling Push for portlets with main
branch (Vaadin 23.3) and Liferay 7.4:
IllegalStateException
from JSR356AsyncSupport
. Its a result from ServletContext#getAttribute(ServerContainer.class.getName())
call which ends up (through proxies and wrappers) to org.eclipse.equinox.http.servlet.internal.ServletContextAdaptor#getAttribute(String)
which can't find the ServerContainer
even though it is available in the 'real' ServletContext
that this object wraps.Could this be a bug in Equinox or maybe a missing OSGi configuration in portlet app? Needs more investigation to answer these. Forcing ServerContainer
to be available for JSR356AsyncSupport
lead to other error so this is not the only obstacle.
WebSockets can be suppressed with org.atmosphere.websocket.suppressJSR356=true
init parameter for the Atmosphere which will end up using Long Polling instead and initialization works without errors. Looks like Push with Long polling could work easier. It would make sense to start to make Long polling work first.
Portlet's client side is not setup with correct paths regarding Push client (vaadinPush-min.js
), so this may need changes in Flow's Push Java API to make it possible to change paths easier for portlets. This issue makes it currently harder to verify if Push is setup correctly and works when suppressJSR356
is enabled.
There's also open question if we really need to create Vaadin servlet instance at all for portlet just to get Flow's Push feature to work or should we write completely new initialization code for the portlet's Push instead and disable automatic Vaadin servlet creation permanently.
Vaadin Push functionality doesn't work with Vaadin 14 Portlet integration.
The following code used to enable Push in a portlet application:
doesn't work in both Apache Pluto and Liferay 7 (tested with 7.3) containers.
vaadinPush-min.js
resource as shown below:Jsr356_exception.txt
and also with the failed request to
vaadinPush-min.js
:In the Liferay case, the
ServerContainer
implementation cannot be found in the givenServletContext
, here is a call sequence:JSR356WebsocketInitializer::contextInitialized
PushRequestHandler::initAtmosphere
is called and the atmosphere framework is being customizedAtmosphereFramework::init
Atmosphere framework tries to instantiate a
JSR356AsyncSupport
but throws because theservlerContainer
is not found:Liferay 7.3 provides a WebSocket implementation already, according to https://help.liferay.com/hc/en-us/articles/360018161191-Liferay-WebSocket-Whiteboard , but it seems the servlet context the atmosphere framework is looking into, has no server container, but it is available in the OSGi context, for instance if the Liferay puts the
ServerContainer
into oneServletContext
object, but the portlet uses another object (this is my raw guess).Vaadin OSGi integration has a similar Push issue, so the problem might be in OSGi specifics.
This ticket is an investigation ticket and doesn't contain any certain suggestions about the feature support implementation so far.
While it is an issue for a Vaadin Portlet and if it an option for you to replace server-to-client async updates in your project, you can use client-to-server async updates like shown below: