IDEMPIERE-2110 make the session timeout of zk configurable

This commit is contained in:
Carlos Ruiz 2014-07-31 17:26:12 +02:00
parent 6b391f688e
commit f16c7d6367
2 changed files with 13 additions and 1 deletions

View File

@ -42,7 +42,7 @@ public class MSysConfig extends X_AD_SysConfig
/**
*
*/
private static final long serialVersionUID = 8682693142401650434L;
private static final long serialVersionUID = -4115621058281458156L;
public static final String ADDRESS_SAVE_REQUEST_RESPONSE_LOG = "ADDRESS_SAVE_REQUEST_RESPONSE_LOG";
public static final String ADDRESS_VALIDATION = "ADDRESS_VALIDATION";
@ -140,6 +140,7 @@ public class MSysConfig extends X_AD_SysConfig
public static final String ZK_REPORT_JASPER_OUTPUT_TYPE = "ZK_REPORT_JASPER_OUTPUT_TYPE";
public static final String ZK_REPORT_TABLE_OUTPUT_TYPE = "ZK_REPORT_TABLE_OUTPUT_TYPE";
public static final String ZK_ROOT_FOLDER_BROWSER = "ZK_ROOT_FOLDER_BROWSER";
public static final String ZK_SESSION_TIMEOUT_IN_SECONDS = "ZK_SESSION_TIMEOUT_IN_SECONDS";
public static final String ZK_THEME = "ZK_THEME";
/**

View File

@ -26,6 +26,8 @@ package org.adempiere.webui.panel;
import java.sql.Timestamp;
import java.util.Properties;
import javax.servlet.http.HttpSession;
import org.adempiere.util.Callback;
import org.adempiere.webui.AdempiereIdGenerator;
import org.adempiere.webui.LayoutUtils;
@ -55,6 +57,8 @@ import org.zkoss.zhtml.Td;
import org.zkoss.zhtml.Tr;
import org.zkoss.zk.au.out.AuFocus;
import org.zkoss.zk.au.out.AuScript;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.Session;
import org.zkoss.zk.ui.WrongValueException;
import org.zkoss.zk.ui.event.Deferrable;
import org.zkoss.zk.ui.event.Event;
@ -609,6 +613,13 @@ public class RolePanel extends Window implements EventListener<Event>, Deferrabl
String msg = login.loadPreferences(orgKNPair, warehouseKNPair, date, null);
if (Util.isEmpty(msg))
{
Session currSess = Executions.getCurrent().getDesktop().getSession();
HttpSession httpSess = (HttpSession) currSess.getNativeSession();
int timeout = MSysConfig.getIntValue(MSysConfig.ZK_SESSION_TIMEOUT_IN_SECONDS, -2, Env.getAD_Client_ID(Env.getCtx()), Env.getAD_Org_ID(Env.getCtx()));
if (timeout != -2) // default to -2 meaning not set
httpSess.setMaxInactiveInterval(timeout);
msg = login.validateLogin(orgKNPair);
}
if (! Util.isEmpty(msg))