Merge origin/release-7.1

This commit is contained in:
hengsin 2020-03-17 17:44:47 +08:00
commit f6a8d4865d
4 changed files with 29 additions and 13 deletions

View File

@ -207,8 +207,8 @@ public class AtmosphereServerPush implements ServerPush {
}
}
if (!ok) {
log.warn("Failed to resume long polling resource");
Desktop d = desktop.get();
Desktop d = desktop.get();
log.warn("Failed to resume long polling resource" + (d != null ? " for desktop " + d.getId() : ""));
if (d != null) {
Integer count = (Integer) d.getAttribute(AdempiereWebUI.SERVERPUSH_SCHEDULE_FAILURES);
if (count != null)

View File

@ -119,7 +119,9 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
private ConcurrentMap<String, String[]> m_URLParameters;
public static final String SERVERPUSH_SCHEDULE_FAILURES = "serverpush.schedule.failures";
private static final String ON_LOGIN_COMPLETED = "onLoginCompleted";
public AdempiereWebUI()
{
this.setVisible(false);
@ -127,12 +129,16 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
userPreference = new UserPreference();
// preserve the original URL parameters as is destroyed later on loging
m_URLParameters = new ConcurrentHashMap<String, String[]>(Executions.getCurrent().getParameterMap());
this.addEventListener(ON_LOGIN_COMPLETED, this);
}
public void onCreate()
{
this.getPage().setTitle(ThemeManager.getBrowserTitle());
Executions.getCurrent().getDesktop().enableServerPush(true);
SessionManager.setSessionApplication(this);
Session session = Executions.getCurrent().getDesktop().getSession();
@SuppressWarnings("unchecked")
@ -153,11 +159,11 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
}
else
{
loginCompleted();
Clients.showBusy(null);
//use echo event to make sure server push have been started when loginCompleted is call
Events.echoEvent(ON_LOGIN_COMPLETED, this, null);
}
Executions.getCurrent().getDesktop().enableServerPush(true);
Executions.getCurrent().getDesktop().addListener(new DrillCommand());
Executions.getCurrent().getDesktop().addListener(new TokenCommand());
Executions.getCurrent().getDesktop().addListener(new ZoomCommand());
@ -485,7 +491,9 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
if (appDesktop != null)
appDesktop.setClientInfo(clientInfo);
}
} else if (event.getName().equals(ON_LOGIN_COMPLETED)) {
loginCompleted();
}
}
@ -541,10 +549,13 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
if (desktop.isServerPushEnabled())
desktop.enableServerPush(false);
Session session = logout0();
//clear context and invalidate session
DesktopCache desktopCache = ((SessionCtrl)session).getDesktopCache();
//clear context
Env.getCtx().clear();
((SessionCtrl)session).invalidateNow();
//invalidate session
((SessionCtrl)session).invalidateNow();
//put saved context into new session
Map<String, Object> map = new HashMap<String, Object>();
@ -555,7 +566,12 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
newSession.setAttribute(SAVED_CONTEXT, map);
properties.setProperty(SessionContextListener.SERVLET_SESSION_ID, newSession.getId());
Executions.sendRedirect("index.zul");
//redirect must happens before removeDesktop below, otherwise you get NPE
Executions.getCurrent().sendRedirect("index.zul");
//remove old desktop
if (desktopCache != null)
desktopCache.removeDesktop(desktop);
}
@Override

View File

@ -575,7 +575,6 @@ public class WAttachment extends Window implements EventListener<Event>
} else if (e.getTarget() == bDeleteAll) {
// Delete Attachment
deleteAttachment();
dispose();
} else if (e.getTarget() == bDelete) {
// Delete individual entry and Return
deleteAttachmentEntry();
@ -676,6 +675,7 @@ public class WAttachment extends Window implements EventListener<Event>
m_attachment.delete(true);
m_attachment = null;
}
dispose();
}
}
});

View File

@ -103,7 +103,7 @@ Copyright (C) 2007 Ashley G Ramdass.
}
});
zk.afterLoad('zul.wgt', function () {
zk.afterLoad('zul.inp', function () {
// should filter out for only component inside standard window or component wish fire this event,
// or ever rise other event like start editting to distinguish with true onChange event