@org.omnifaces.cdi.ViewScoped invokes @PostConstruct on unload of an already destroyed view

可紊 提交于 2019-12-23 02:52:54

问题


I have a problem working with @org.omnifaces.cdi.ViewScoped and multiple tabs:

I have a link in TestPage.xhtml that opens another page (ShowValuePage.xhtml) with a request parameter "someValue". If I open this link 10 times in a new tab and navigate away in the first opened tab, PostConstruct will be called again instead of just navigating away.

Same happens if I navigate back from ShowValuePage to TestPage multiple times. (To test this, we must click the links "Show Value" and "Home" multiple times).

This only happens if more tabs are opened than defined in the web.xml values "numberOfLogicalViews" and "numberOfViewsInSession".

I've set up a small project that shows this problem. The exact description of the procedure can be found in the readme.txt.

Project on github

Is there a workaround for this?

Thank you and best regards

Heinrich

PS: I reported it as a bug on Omnifaces, but since a week I didn't get an answer.


回答1:


It's fixed in OmniFaces 2.7.1 and 3.3.

The symptoms were caused by an explicit redirect which was initially in place in order to trigger any authentication framework which remembers the "last restricted request" to remember the correct request in case the session is expired. This has been fixed by sending the redirect only and only if the session is actually new.



来源:https://stackoverflow.com/questions/52479878/org-omnifaces-cdi-viewscoped-invokes-postconstruct-on-unload-of-an-already-des

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!