Commit 590e6ba8 by fukai

支持不限超时的情况

parent 69e4d0ae
...@@ -9,6 +9,7 @@ import javax.servlet.ServletContextListener; ...@@ -9,6 +9,7 @@ import javax.servlet.ServletContextListener;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.sss.presentation.noui.context.NoUiContextManager; import org.sss.presentation.noui.context.NoUiContextManager;
import org.sss.presentation.noui.util.RedisUtil;
import log.Log; import log.Log;
import log.LogFactory; import log.LogFactory;
...@@ -33,7 +34,12 @@ public class NoUiApiInitListener implements ServletContextListener { ...@@ -33,7 +34,12 @@ public class NoUiApiInitListener implements ServletContextListener {
public void contextInitialized(ServletContextEvent contextEvent) { public void contextInitialized(ServletContextEvent contextEvent) {
ServletContext context = contextEvent.getServletContext(); ServletContext context = contextEvent.getServletContext();
String dbType = context.getInitParameter(DATABASE_SUPPORT_TYPE); String dbType = context.getInitParameter(DATABASE_SUPPORT_TYPE);
int timeout = Integer.valueOf(context.getInitParameter(NOUI_TIMEOUT));
int timeout = Integer.valueOf(context.getInitParameter(NOUI_TIMEOUT)); //秒数
if(timeout > 0)
RedisUtil.setSessionTimeOut(timeout);
else
RedisUtil.setSessionTimeOut(3*30*24*60*60); //一个月
NoUiContextManager.dbType = dbType; NoUiContextManager.dbType = dbType;
NoUiContextManager.loginContextName = context.getInitParameter(LOGIN_CONTEXT_NAME); NoUiContextManager.loginContextName = context.getInitParameter(LOGIN_CONTEXT_NAME);
String openSource = context.getInitParameter(OPEN_PREFIX); String openSource = context.getInitParameter(OPEN_PREFIX);
......
...@@ -20,7 +20,11 @@ public class RedisUtil { ...@@ -20,7 +20,11 @@ public class RedisUtil {
static { static {
initialPool(); initialPool();
} }
public static void setSessionTimeOut(int time){
sessionTimeOut = time;
}
public static int getSessionTimeOut() { public static int getSessionTimeOut() {
return sessionTimeOut; return sessionTimeOut;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment