IDEMPIERE-4512 zk9.5 - Timeout page is not working (#384)

This commit is contained in:
hengsin 2020-11-17 01:18:49 +08:00 committed by GitHub
parent 3adbc9e00f
commit 052a9e8474
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 41 additions and 12 deletions

View File

@ -236,11 +236,18 @@ public class AtmosphereServerPush implements ServerPush {
return; return;
} }
this.resource.set(null); AtmosphereResource currentResource = this.resource.getAndSet(null);
synchronized (schedules) { synchronized (schedules) {
schedules.clear(); schedules.clear();
} }
if (currentResource != null ) {
try {
currentResource.close();
} catch (IOException e) {
}
}
if (Executions.getCurrent() != null) { if (Executions.getCurrent() != null) {
if (log.isDebugEnabled()) if (log.isDebugEnabled())
log.debug("Stopping server push for " + desktop); log.debug("Stopping server push for " + desktop);

View File

@ -47,15 +47,15 @@ Copyright (C) 2007 Ashley G Ramdass (ADempiere WebUI).
<javascript src="/js/calc.js" charset="UTF-8"/> <javascript src="/js/calc.js" charset="UTF-8"/>
<javascript src="/js/layout.js" charset="UTF-8"/> <javascript src="/js/layout.js" charset="UTF-8"/>
<javascript src="/js/report.js" charset="UTF-8"/> <javascript src="/js/report.js" charset="UTF-8"/>
<!-- <javascript src="/js/persist-min.js" charset="UTF-8"/> -->
<javascript src="/js/token.js" charset="UTF-8"/>
<javascript src="/js/window.js" charset="UTF-8"/> <javascript src="/js/window.js" charset="UTF-8"/>
<javascript src="/js/html2canvas.js" charset="UTF-8"/> <javascript src="/js/html2canvas.js" charset="UTF-8"/>
<javascript src="/js/jquery.maskedinput.js" charset="UTF-8"/> <javascript src="/js/jquery.maskedinput.js" charset="UTF-8"/>
<javascript src="/js/photobooth_min.js" charset="UTF-8"/> <javascript src="/js/photobooth_min.js" charset="UTF-8"/>
<javascript package="jawwa.atmosphere" merge="false" /> <javascript package="jawwa.atmosphere" merge="false" />
<javascript package="org.idempiere.websocket" merge="false" /> <javascript package="org.idempiere.websocket" merge="false" />
<javascript package="adempiere.local.storage" merge="false" />
<javascript-module name="jawwa.atmosphere" version="202011161530"/>
<javascript-module name="adempiere.local.storage" version="202011151100"/>
</language> </language>

View File

@ -11,7 +11,9 @@
* with this program; if not, write to the Free Software Foundation, Inc., * * with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/ *****************************************************************************/
var adempiere = {};
window.adempiere = {};
var adempiere = window.adempiere;
adempiere.isSupportSavePass=typeof(Storage) !== "undefined"; adempiere.isSupportSavePass=typeof(Storage) !== "undefined";
adempiere.saveUserToken = function (key, hash, sessionId) adempiere.saveUserToken = function (key, hash, sessionId)

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<package name="adempiere.local.storage" language="xul/html">
<script src="token.js" />
</package>

View File

@ -59,7 +59,7 @@
if (me.trace) if (me.trace)
console.log("complete"+ " dtid: " + me.desktop.id); console.log("complete"+ " dtid: " + me.desktop.id);
if (me._req && me._req.statusText == "SessionNotFound" && me._req.status == 400) { if (me._req && me._req.statusText == "SessionNotFound" && me._req.status == 400) {
;//stop sent request:IDEMPIERE-4237 me._timeout();
} else { } else {
me._schedule(); me._schedule();
} }
@ -71,6 +71,7 @@
setTimeout(this.proxy(this._send), this.delay); setTimeout(this.proxy(this._send), this.delay);
} else { } else {
this.stop(); this.stop();
this._serverError();
} }
}, },
_send: function() { _send: function() {
@ -99,6 +100,19 @@
this._req.abort(); this._req.abort();
this._req = null; this._req = null;
} }
},
_timeout: function() {
_serverError();
},
_serverError: function() {
zk.confirmClose = false;
adempiere.get("zkTimeoutText", function(ok, val) {
if (ok && !!val)
{
alert(val);
}
window.location.href="index.zul";
});
} }
}); });
})(); })();

View File

@ -85,11 +85,11 @@
<!-- /////////// --> <!-- /////////// -->
<!-- Miscellaneous --> <!-- Miscellaneous -->
<session-config> <session-config>
<session-timeout>60</session-timeout>
<cookie-config> <cookie-config>
<http-only>true</http-only> <http-only>true</http-only>
<secure>true</secure> <secure>true</secure>
</cookie-config> </cookie-config>
<session-timeout>60</session-timeout>
</session-config> </session-config>
<!-- MIME mapping --> <!-- MIME mapping -->

View File

@ -38,7 +38,7 @@
<session-config> <session-config>
<device-type>ajax</device-type> <device-type>ajax</device-type>
<automatic-timeout/> <!-- the same as <automatic-timeout>true</automatic-timeout> --> <automatic-timeout>true</automatic-timeout>
<timeout-uri>/timeout.zul</timeout-uri> <timeout-uri>/timeout.zul</timeout-uri>
</session-config> </session-config>

View File

@ -15,6 +15,8 @@ Copyright (C) 2007 Ashley G Ramdass.
<?link rel="manifest" href="manifest.json"?> <?link rel="manifest" href="manifest.json"?>
<zk> <zk>
<script><![CDATA[ <script><![CDATA[
zk.load("adempiere.local.storage");
zk.afterLoad(function() { zk.afterLoad(function() {
zk._Erbx.push = function(msg) { zk._Erbx.push = function(msg) {
if (console) console.log(msg); if (console) console.log(msg);

View File

@ -15,7 +15,7 @@
<div id="timeoutText"></div> <div id="timeoutText"></div>
<div style="margin-top: 10px"> <div style="margin-top: 10px">
<toolbarbutton id="continueText" href="/index.zul" label="Continue"/> <button id="continueText" href="/index.zul" label="Continue"/>
</div> </div>
</vbox> </vbox>
<script defer="true"> <script defer="true">