IDEMPIERE-4237 timeout page continue do comet request and log a lot message (#100)

Revert SC_NO_Content for error bad to SC_BAD_REQUEST so that the failure
count at client side will work.
Add session timeout/notfound checking at client side.
This commit is contained in:
hengsin 2020-06-03 21:17:52 +08:00 committed by GitHub
parent 4c3521caa9
commit 8f052b4081
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -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<String, Session>("Could not find session", null);
return new Either<String, Session>(SESSION_NOT_FOUND, null);
} else {
return new Either<String, Session>(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;

View File

@ -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() {