会话超时紧随页面重新加载,开始新会话

发布于 2025-02-05 07:08:01 字数 3679 浏览 3 评论 0原文

当发生VaadinSession超时时,该页面会自动重新加载新的VaadinSession。

vaadin 23.0.5

下面,我在会话结束并重新加载的情况下包括了Chrome Console日志。 没有什么表明为什么在Java日志中进行的。 这(对我来说)似乎是在浏览器中启动的,可能是由服务工作者启动的吗?

对进一步的诊断或仅仅是一个完全解决方案的建议(我可以做梦)将不胜感激。

这是镀铬控制台,因为会话终止...

Received push (websocket) message: for(;;);[{"syncId":4,"clientId":2,"meta":{"async":true,"sessionExpired":true},"timings":[5,0]}]
FlowClient.js?2d7e:1004 Handling message from server
FlowClient.js?2d7e:944 Handling dependencies
FlowClient.js?2d7e:193 handleUIDLMessage: 0 ms
vaadinPush.js?v=23.0.4:3323 Mon Jun 06 2022 13:41:09 GMT+1000 (Australian Eastern Standard Time) Atmosphere: beforeunload event
FlowClient.js?2d7e:193 Setting heartbeat interval to -1sec.
FlowClient.js?2d7e:835 Disabling heartbeat
FlowClient.js?2d7e:936 Closing push connection
vaadinPush.js?v=23.0.4:3323 Mon Jun 06 2022 13:41:09 GMT+1000 (Australian Eastern Standard Time) Atmosphere: Closing (AtmosphereRequest._close() called)
vaadinPush.js?v=23.0.4:3323 Mon Jun 06 2022 13:41:09 GMT+1000 (Australian Eastern Standard Time) Atmosphere: Firing onClose (unsubscribe case)
FlowClient.js?2d7e:1006 Push connection closed
vaadinPush.js?v=23.0.4:3323 Mon Jun 06 2022 13:41:09 GMT+1000 (Australian Eastern Standard Time) Atmosphere: Request already closed, not firing onClose (unsubscribe case)
vaadinPush.js?v=23.0.4:3323 Mon Jun 06 2022 13:41:09 GMT+1000 (Australian Eastern Standard Time) Atmosphere: invoking .close() on WebSocket object
FlowClient.js?2d7e:193  Processing time was 5ms
vaadinPush.js?v=23.0.4:3323 Mon Jun 06 2022 13:41:09 GMT+1000 (Australian Eastern Standard Time) Atmosphere: Request already closed, not firing onClose (unsubscribe case)
logger.js?aa4d:46 workbox No route found for: /?v-r=push&v-uiId=0&v-pushId=09139213-af19-48d7-8a55-278da41b839f&X-Atmosphere-Transport=close&X-Atmosphere-tracking-id=3c2a0c76-86d7-4952-a1c4-80786dd19bd0
vaadinPush.js?v=23.0.4:3323 Mon Jun 06 2022 13:41:09 GMT+1000 (Australian Eastern Standard Time) Atmosphere: websocket.onclose
vaadinPush.js?v=23.0.4:3323 Websocket closed, reason: Normal closure; the connection successfully completed whatever purpose for which it was created. - wasClean: true
log @ vaadinPush.js?v=23.0.4:3323
warn @ vaadinPush.js?v=23.0.4:3329
_websocket.onclose @ vaadinPush.js?v=23.0.4:1537
vaadinPush.js?v=23.0.4:3323 Mon Jun 06 2022 13:41:09 GMT+1000 (Australian Eastern Standard Time) Atmosphere: Request already closed, not firing onClose (closed case)
vaadinPush.js?v=23.0.4:3323 Mon Jun 06 2022 13:41:09 GMT+1000 (Australian Eastern Standard Time) Atmosphere: Request already closed, not firing onClose (closed case)
vaadinPush.js?v=23.0.4:3323 Websocket closed normally

,在页面重新加载时紧随其后...

logger.js?aa4d:46 workbox The navigation route / is being used.
logger.js?aa4d:46 workbox Router is responding to: /
logger.js?aa4d:46 workbox Network request for '/' returned a response with status '200'.
logger.js?aa4d:46 workbox Using NetworkOnly to respond to '/'
​ Mon Jun 06 2022 13:41:11 GMT+1000 (Australian Eastern Standard Time) Atmosphere: unload event
logger.js?aa4d:46 workbox No route found for: 
https://api.breadbutter.io/apps/xxxxxxxxxxxxxxxx/prerelease/page_engagement
logger.js?aa4d:46 workbox Router is responding to: /VAADIN/build/vaadin-bundle-52a045587b10cc017547.cache.js
logger.js?aa4d:46 workbox Found a cached response in 'workbox-precache-v2-https://mylocalhost/'.
logger.js?aa4d:46 workbox Precaching did not find a match for /?v-r=init&location=
logger.js?aa4d:46 workbox No route found for: /?v-r=init&location=
logger.js?aa4d:46 

When the VaadinSession timeout happens, the page automatically reloads starting a new VaadinSession.

Vaadin 23.0.5

Below, I have included the Chrome console log as the session ends and the reload happens.
There is nothing indicating why this is going on in the java logs.
This appears (to me) to be initiated in the browser, possibly by the service worker?

Suggestions for further diagnostics, or just an outright solution (I can dream) would be greatly appreciated.

Here is the Chrome console as the Session terminates...

Received push (websocket) message: for(;;);[{"syncId":4,"clientId":2,"meta":{"async":true,"sessionExpired":true},"timings":[5,0]}]
FlowClient.js?2d7e:1004 Handling message from server
FlowClient.js?2d7e:944 Handling dependencies
FlowClient.js?2d7e:193 handleUIDLMessage: 0 ms
vaadinPush.js?v=23.0.4:3323 Mon Jun 06 2022 13:41:09 GMT+1000 (Australian Eastern Standard Time) Atmosphere: beforeunload event
FlowClient.js?2d7e:193 Setting heartbeat interval to -1sec.
FlowClient.js?2d7e:835 Disabling heartbeat
FlowClient.js?2d7e:936 Closing push connection
vaadinPush.js?v=23.0.4:3323 Mon Jun 06 2022 13:41:09 GMT+1000 (Australian Eastern Standard Time) Atmosphere: Closing (AtmosphereRequest._close() called)
vaadinPush.js?v=23.0.4:3323 Mon Jun 06 2022 13:41:09 GMT+1000 (Australian Eastern Standard Time) Atmosphere: Firing onClose (unsubscribe case)
FlowClient.js?2d7e:1006 Push connection closed
vaadinPush.js?v=23.0.4:3323 Mon Jun 06 2022 13:41:09 GMT+1000 (Australian Eastern Standard Time) Atmosphere: Request already closed, not firing onClose (unsubscribe case)
vaadinPush.js?v=23.0.4:3323 Mon Jun 06 2022 13:41:09 GMT+1000 (Australian Eastern Standard Time) Atmosphere: invoking .close() on WebSocket object
FlowClient.js?2d7e:193  Processing time was 5ms
vaadinPush.js?v=23.0.4:3323 Mon Jun 06 2022 13:41:09 GMT+1000 (Australian Eastern Standard Time) Atmosphere: Request already closed, not firing onClose (unsubscribe case)
logger.js?aa4d:46 workbox No route found for: /?v-r=push&v-uiId=0&v-pushId=09139213-af19-48d7-8a55-278da41b839f&X-Atmosphere-Transport=close&X-Atmosphere-tracking-id=3c2a0c76-86d7-4952-a1c4-80786dd19bd0
vaadinPush.js?v=23.0.4:3323 Mon Jun 06 2022 13:41:09 GMT+1000 (Australian Eastern Standard Time) Atmosphere: websocket.onclose
vaadinPush.js?v=23.0.4:3323 Websocket closed, reason: Normal closure; the connection successfully completed whatever purpose for which it was created. - wasClean: true
log @ vaadinPush.js?v=23.0.4:3323
warn @ vaadinPush.js?v=23.0.4:3329
_websocket.onclose @ vaadinPush.js?v=23.0.4:1537
vaadinPush.js?v=23.0.4:3323 Mon Jun 06 2022 13:41:09 GMT+1000 (Australian Eastern Standard Time) Atmosphere: Request already closed, not firing onClose (closed case)
vaadinPush.js?v=23.0.4:3323 Mon Jun 06 2022 13:41:09 GMT+1000 (Australian Eastern Standard Time) Atmosphere: Request already closed, not firing onClose (closed case)
vaadinPush.js?v=23.0.4:3323 Websocket closed normally

Which is immediately followed with the page reloading...

logger.js?aa4d:46 workbox The navigation route / is being used.
logger.js?aa4d:46 workbox Router is responding to: /
logger.js?aa4d:46 workbox Network request for '/' returned a response with status '200'.
logger.js?aa4d:46 workbox Using NetworkOnly to respond to '/'
​ Mon Jun 06 2022 13:41:11 GMT+1000 (Australian Eastern Standard Time) Atmosphere: unload event
logger.js?aa4d:46 workbox No route found for: 
https://api.breadbutter.io/apps/xxxxxxxxxxxxxxxx/prerelease/page_engagement
logger.js?aa4d:46 workbox Router is responding to: /VAADIN/build/vaadin-bundle-52a045587b10cc017547.cache.js
logger.js?aa4d:46 workbox Found a cached response in 'workbox-precache-v2-https://mylocalhost/'.
logger.js?aa4d:46 workbox Precaching did not find a match for /?v-r=init&location=
logger.js?aa4d:46 workbox No route found for: /?v-r=init&location=
logger.js?aa4d:46 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

逆夏时光 2025-02-12 07:08:01

是的,这是预期的行为。

您需要设置servlet初始化的侦听器,并在那里定义自定义的系统消息,sessigeepriedurl需要不为null(null是默认值,如果它为null,则页面将在会话过期时重新加载)

       getService()
                .setSystemMessagesProvider(new SystemMessagesProvider() {
                    @Override
                    public SystemMessages getSystemMessages(
                            SystemMessagesInfo systemMessagesInfo) {
                        CustomizedSystemMessages messages = new CustomizedSystemMessages();
                        messages.setSessionExpiredNotificationEnabled(
                                false); // or true
                        messages.setSessionExpiredURL( USE NON-NULL VALUE HERE );
                        return messages;
                    }
                });

Yes, this is intended behavior.

You need to setup servlet initialized listener and there define customized system messages, there sessionExpiredURL needs to be not null (null is the default value, and if it is null, page will reload upon session expired)

       getService()
                .setSystemMessagesProvider(new SystemMessagesProvider() {
                    @Override
                    public SystemMessages getSystemMessages(
                            SystemMessagesInfo systemMessagesInfo) {
                        CustomizedSystemMessages messages = new CustomizedSystemMessages();
                        messages.setSessionExpiredNotificationEnabled(
                                false); // or true
                        messages.setSessionExpiredURL( USE NON-NULL VALUE HERE );
                        return messages;
                    }
                });
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文