vaadin / portlet

Portlet support for Vaadin Flow
https://vaadin.com
Other
2 stars 3 forks source link

Liferay with Vaadin Portlet v1 using LitTemplate not working #234

Open krissvaa opened 2 years ago

krissvaa commented 2 years ago

When using SO-Charts addon in Liferay Vaadin portlet NullPointerException is thrown. SO-Charts uses LitTemplate to add a component for the "echarts" Javascript library. NullPointerException is thrown when rendering the component.

Problem lays in how LitTemplate tries to get Vaadin Portlet external stats JSON.

1)LitTemplate is initialized in the ReflectionCache wrapper that clears session, and request (CurrentInstants) information for initialization. LitTemplateInitializer:L87 ReflectionCache:L78

2)Portlets use external stats JSON with URL configured as a relative path without the scheme, host, and port. Scheme, host, and port are intended to get from VaadinRequest.getCurrent(), but there lies the problem as VaadinRequest is null because of the first point with ReflectionCache cleared session wrapper. FrontendUtils:L574 FrontendUtils:L753

The current Workaround for this is to include the host in external stats JSON configuration like this: "externalStatsUrl": "http://localhost:8080/o/vaadin-portlet-static/VAADIN/config/stats.json"