diff --git a/org.adempiere.ui.zk/WEB-INF/src/fi/jawsy/jawwa/zk/atmosphere/ZkAtmosphereHandler.java b/org.adempiere.ui.zk/WEB-INF/src/fi/jawsy/jawwa/zk/atmosphere/ZkAtmosphereHandler.java index 049aaf509c..a3c5c3e65f 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/fi/jawsy/jawwa/zk/atmosphere/ZkAtmosphereHandler.java +++ b/org.adempiere.ui.zk/WEB-INF/src/fi/jawsy/jawwa/zk/atmosphere/ZkAtmosphereHandler.java @@ -43,6 +43,7 @@ import org.zkoss.zk.ui.sys.WebAppCtrl; */ public class ZkAtmosphereHandler implements AtmosphereHandler { + private static final String SESSION_NOT_FOUND = "SessionNotFound"; private final Logger log = LoggerFactory.getLogger(this.getClass()); @Override @@ -111,7 +112,7 @@ public class ZkAtmosphereHandler implements AtmosphereHandler { Session session = WebManager.getSession(resource.getAtmosphereConfig().getServletContext(), request, false); if (session == null) { log.warn("Could not find session: " + request.getRequestURI()); - return new Either("Could not find session", null); + return new Either(SESSION_NOT_FOUND, null); } else { return new Either(null, session); } @@ -128,7 +129,7 @@ public class ZkAtmosphereHandler implements AtmosphereHandler { if (error != null && serverPushEither.getRightValue() == null) { if (log.isDebugEnabled()) log.warn("Bad Request. Error="+error+", Request="+resource.getRequest().getRequestURI()); - response.setStatus(HttpServletResponse.SC_NO_CONTENT); + response.setStatus(HttpServletResponse.SC_BAD_REQUEST, error); response.getWriter().write(""); response.getWriter().flush(); return; diff --git a/org.adempiere.ui.zk/WEB-INF/src/web/js/jawwa/atmosphere/serverpush.js b/org.adempiere.ui.zk/WEB-INF/src/web/js/jawwa/atmosphere/serverpush.js index eabe053fe0..ace93ffb81 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/web/js/jawwa/atmosphere/serverpush.js +++ b/org.adempiere.ui.zk/WEB-INF/src/web/js/jawwa/atmosphere/serverpush.js @@ -58,7 +58,11 @@ this.ajaxOptions.complete = function() { if (me.trace) console.log("complete"+ " dtid: " + me.desktop.id); - me._schedule(); + if (me._req && me._req.statusText == "SessionNotFound" && me._req.status == 400) { + ;//stop sent request:IDEMPIERE-4237 + } else { + me._schedule(); + } }; }, _schedule: function() {