Merge release-7.1 into master
This commit is contained in:
commit
f30c94939b
|
@ -242,13 +242,16 @@ public class AtmosphereServerPush implements ServerPush {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (log.isDebugEnabled())
|
this.resource.set(null);
|
||||||
log.debug("Stopping server push for " + desktop);
|
synchronized (schedules) {
|
||||||
Clients.response("jawwa.atmosphere.serverpush", new AuScript(null, "jawwa.atmosphere.stopServerPush('" + desktop.getId() + "');"));
|
schedules.clear();
|
||||||
try {
|
|
||||||
commitResponse();
|
|
||||||
} catch (IOException e) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Executions.getCurrent() != null) {
|
||||||
|
if (log.isDebugEnabled())
|
||||||
|
log.debug("Stopping server push for " + desktop);
|
||||||
|
Clients.response("jawwa.atmosphere.serverpush", new AuScript(null, "jawwa.atmosphere.stopServerPush('" + desktop.getId() + "');"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onRequest(AtmosphereResource resource) {
|
public void onRequest(AtmosphereResource resource) {
|
||||||
|
|
|
@ -369,6 +369,10 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
|
||||||
*/
|
*/
|
||||||
public void logout()
|
public void logout()
|
||||||
{
|
{
|
||||||
|
Desktop desktop = Executions.getCurrent().getDesktop();
|
||||||
|
if (desktop.isServerPushEnabled())
|
||||||
|
desktop.enableServerPush(false);
|
||||||
|
|
||||||
Session session = logout0();
|
Session session = logout0();
|
||||||
DesktopCache desktopCache = ((SessionCtrl)session).getDesktopCache();
|
DesktopCache desktopCache = ((SessionCtrl)session).getDesktopCache();
|
||||||
|
|
||||||
|
@ -383,6 +387,10 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
|
||||||
desktopCache.removeDesktop(Executions.getCurrent().getDesktop());
|
desktopCache.removeDesktop(Executions.getCurrent().getDesktop());
|
||||||
}
|
}
|
||||||
public void logoutAfterTabDestroyed(){
|
public void logoutAfterTabDestroyed(){
|
||||||
|
Desktop desktop = Executions.getCurrent().getDesktop();
|
||||||
|
if (desktop.isServerPushEnabled())
|
||||||
|
desktop.enableServerPush(false);
|
||||||
|
|
||||||
Session session = logout0();
|
Session session = logout0();
|
||||||
|
|
||||||
//clear context, invalidate session
|
//clear context, invalidate session
|
||||||
|
@ -392,7 +400,7 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
|
||||||
|
|
||||||
|
|
||||||
protected Session logout0() {
|
protected Session logout0() {
|
||||||
Session session = Executions.getCurrent().getDesktop().getSession();
|
Session session = Executions.getCurrent() != null ? Executions.getCurrent().getDesktop().getSession() : null;
|
||||||
|
|
||||||
if (keyListener != null) {
|
if (keyListener != null) {
|
||||||
keyListener.detach();
|
keyListener.detach();
|
||||||
|
@ -409,7 +417,8 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
|
||||||
getPage().removeComponents();
|
getPage().removeComponents();
|
||||||
|
|
||||||
//clear session attributes
|
//clear session attributes
|
||||||
session.getAttributes().clear();
|
if (session != null)
|
||||||
|
session.getAttributes().clear();
|
||||||
|
|
||||||
//logout ad_session
|
//logout ad_session
|
||||||
AEnv.logout();
|
AEnv.logout();
|
||||||
|
|
|
@ -4,7 +4,9 @@
|
||||||
if (dt._serverpush)
|
if (dt._serverpush)
|
||||||
dt._serverpush.stop();
|
dt._serverpush.stop();
|
||||||
|
|
||||||
var spush = new jawwa.atmosphere.ServerPush(dt, timeout);
|
//change to true to enable trace of execution
|
||||||
|
var trace = false;
|
||||||
|
var spush = new jawwa.atmosphere.ServerPush(dt, timeout, trace);
|
||||||
spush.start();
|
spush.start();
|
||||||
};
|
};
|
||||||
jawwa.atmosphere.stopServerPush = function(dtid) {
|
jawwa.atmosphere.stopServerPush = function(dtid) {
|
||||||
|
@ -18,6 +20,7 @@
|
||||||
delay: 10,
|
delay: 10,
|
||||||
failures: 0,
|
failures: 0,
|
||||||
timeout: 0,
|
timeout: 0,
|
||||||
|
trace: false,
|
||||||
ajaxOptions: {
|
ajaxOptions: {
|
||||||
url: zk.ajaxURI("/comet", {au: true}),
|
url: zk.ajaxURI("/comet", {au: true}),
|
||||||
type: "GET",
|
type: "GET",
|
||||||
|
@ -27,14 +30,17 @@
|
||||||
data: null,
|
data: null,
|
||||||
dataType: "text"
|
dataType: "text"
|
||||||
},
|
},
|
||||||
$init: function(desktop, timeout) {
|
$init: function(desktop, timeout, trace) {
|
||||||
this.desktop = desktop;
|
this.desktop = desktop;
|
||||||
this.timeout = timeout;
|
this.timeout = timeout;
|
||||||
this.ajaxOptions.data = { dtid: this.desktop.id };
|
this.ajaxOptions.data = { dtid: this.desktop.id };
|
||||||
this.ajaxOptions.timeout = this.timeout;
|
this.ajaxOptions.timeout = this.timeout;
|
||||||
|
this.trace = trace;
|
||||||
var me = this;
|
var me = this;
|
||||||
this.ajaxOptions.error = function(jqxhr, textStatus, errorThrown) {
|
this.ajaxOptions.error = function(jqxhr, textStatus, errorThrown) {
|
||||||
if (textStatus != "timeout") {
|
if (me.trace)
|
||||||
|
console.log("error: " + textStatus + " dtid: " + me.desktop.id);
|
||||||
|
if (textStatus != "timeout" && textStatus != "abort") {
|
||||||
if (typeof console == "object") {
|
if (typeof console == "object") {
|
||||||
console.error(textStatus);
|
console.error(textStatus);
|
||||||
console.error(errorThrown);
|
console.error(errorThrown);
|
||||||
|
@ -43,10 +49,14 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.ajaxOptions.success = function(data) {
|
this.ajaxOptions.success = function(data) {
|
||||||
|
if (me.trace)
|
||||||
|
console.log("success" + " dtid: " + me.desktop.id);
|
||||||
zAu.cmd0.echo(this.desktop);
|
zAu.cmd0.echo(this.desktop);
|
||||||
me.failures = 0;
|
me.failures = 0;
|
||||||
};
|
};
|
||||||
this.ajaxOptions.complete = function() {
|
this.ajaxOptions.complete = function() {
|
||||||
|
if (me.trace)
|
||||||
|
console.log("complete"+ " dtid: " + me.desktop.id);
|
||||||
me._schedule();
|
me._schedule();
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -62,16 +72,22 @@
|
||||||
if (!this.active)
|
if (!this.active)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (this.trace)
|
||||||
|
console.log("_send"+ " dtid: " + this.desktop.id);
|
||||||
var jqxhr = $.ajax(this.ajaxOptions);
|
var jqxhr = $.ajax(this.ajaxOptions);
|
||||||
this._req = jqxhr;
|
this._req = jqxhr;
|
||||||
zAu.cmd0.echo(this.desktop);
|
zAu.cmd0.echo(this.desktop);
|
||||||
},
|
},
|
||||||
start: function() {
|
start: function() {
|
||||||
|
if (this.trace)
|
||||||
|
console.log("start"+ " dtid: " + this.desktop.id);
|
||||||
this.desktop._serverpush = this;
|
this.desktop._serverpush = this;
|
||||||
this.active = true;
|
this.active = true;
|
||||||
this._send();
|
this._send();
|
||||||
},
|
},
|
||||||
stop: function() {
|
stop: function() {
|
||||||
|
if (this.trace)
|
||||||
|
console.log("stop"+ " dtid: " + this.desktop.id);
|
||||||
this.active = false;
|
this.active = false;
|
||||||
this.desktop._serverpush = null;
|
this.desktop._serverpush = null;
|
||||||
if (this._req) {
|
if (this._req) {
|
||||||
|
|
Loading…
Reference in New Issue