IDEMPIERE-4206 Session timeout shown sometimes when changing roles

This commit is contained in:
hengsin 2020-04-01 17:19:18 +08:00
parent 6e606799f9
commit bf8f5ea8c1
2 changed files with 11 additions and 2 deletions

View File

@ -81,6 +81,8 @@ import org.zkoss.zul.Window;
*/
public class AdempiereWebUI extends Window implements EventListener<Event>, IWebClient
{
public static final String DESKTOP_SESSION_INVALIDATED_ATTR = "DesktopSessionInvalidated";
/**
*
*/
@ -569,9 +571,11 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
//redirect must happens before removeDesktop below, otherwise you get NPE
Executions.getCurrent().sendRedirect("index.zul");
//remove old desktop
if (desktopCache != null)
//remove old desktop
if (desktopCache != null) {
desktop.setAttribute(DESKTOP_SESSION_INVALIDATED_ATTR, Boolean.TRUE);
desktopCache.removeDesktop(desktop);
}
}
@Override

View File

@ -237,6 +237,11 @@ public class SessionContextListener implements ExecutionInit,
return;
}
Object sessionInvalidated = desktop.getAttribute(AdempiereWebUI.DESKTOP_SESSION_INVALIDATED_ATTR);
if (sessionInvalidated != null) {
return;
}
if (ServerContext.getCurrentInstance().isEmpty() || !isContextValid())
{
setupExecutionContextFromSession(Executions.getCurrent());