本文整理汇总了Java中org.apache.shiro.web.session.mgt.DefaultWebSessionManager.setSessionValidationSchedulerEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultWebSessionManager.setSessionValidationSchedulerEnabled方法的具体用法?Java DefaultWebSessionManager.setSessionValidationSchedulerEnabled怎么用?Java DefaultWebSessionManager.setSessionValidationSchedulerEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.shiro.web.session.mgt.DefaultWebSessionManager
的用法示例。
在下文中一共展示了DefaultWebSessionManager.setSessionValidationSchedulerEnabled方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: defaultWebSessionManager
import org.apache.shiro.web.session.mgt.DefaultWebSessionManager; //导入方法依赖的package包/类
/**
* @see DefaultWebSessionManager
*/
@Bean(name = "sessionManager")
public DefaultWebSessionManager defaultWebSessionManager() {
DefaultWebSessionManager sessionManager = new DefaultWebSessionManager();
//sessionManager.setSessionDAO(new CustomSessionDAO());
sessionManager.setCacheManager(ehCacheManager());
//单位为毫秒(1秒=1000毫秒) 3600000毫秒为1个小时
sessionManager.setSessionValidationInterval(3600000 * 12);
//3600000 milliseconds = 1 hour
sessionManager.setGlobalSessionTimeout(3600000 * 12);
sessionManager.setDeleteInvalidSessions(true);
sessionManager.setSessionValidationSchedulerEnabled(true);
Cookie cookie = new SimpleCookie(ShiroHttpSession.DEFAULT_SESSION_ID_NAME);
cookie.setName("WEBID");
cookie.setHttpOnly(true);
sessionManager.setSessionIdCookie(cookie);
return sessionManager;
}
示例2: sessionManager
import org.apache.shiro.web.session.mgt.DefaultWebSessionManager; //导入方法依赖的package包/类
@Bean(name = "sessionManager")
public DefaultWebSessionManager sessionManager(){
DefaultWebSessionManager manager = new DefaultWebSessionManager();
//manager.setCacheManager(cacheManager);// 加入缓存管理器
manager.setSessionFactory(shiroSessionFactory());//设置sessionFactory
manager.setSessionDAO(shiroSessionDao());// 设置SessionDao
manager.setDeleteInvalidSessions(true);// 删除过期的session
manager.setGlobalSessionTimeout(shiroSessionDao().getExpireTime());// 设置全局session超时时间
manager.setSessionValidationSchedulerEnabled(true);// 是否定时检查session
return manager;
}
示例3: sessionValidationScheduler
import org.apache.shiro.web.session.mgt.DefaultWebSessionManager; //导入方法依赖的package包/类
@Bean(name = "sessionValidationScheduler")
@DependsOn(value = {"sessionManager"})
@ConditionalOnMissingBean(SessionValidationScheduler.class)
public SessionValidationScheduler sessionValidationScheduler(DefaultWebSessionManager sessionManager) {
ExecutorServiceSessionValidationScheduler validationScheduler = new ExecutorServiceSessionValidationScheduler(sessionManager);
sessionManager.setDeleteInvalidSessions(shiroSessionProperties.isDeleteInvalidSessions());
sessionManager.setSessionValidationInterval(shiroSessionProperties.getValidationInterval());
sessionManager.setSessionValidationSchedulerEnabled(shiroSessionProperties.isValidationSchedulerEnabled());
sessionManager.setSessionValidationScheduler(validationScheduler);
return validationScheduler;
}
示例4: sessionValidationScheduler
import org.apache.shiro.web.session.mgt.DefaultWebSessionManager; //导入方法依赖的package包/类
@Bean(name = "sessionValidationScheduler")
@DependsOn(value = {"sessionManager"})
@ConditionalOnMissingBean(SessionValidationScheduler.class)
public SessionValidationScheduler sessionValidationScheduler(DefaultWebSessionManager sessionManager) {
ExecutorServiceSessionValidationScheduler scheduler = new ExecutorServiceSessionValidationScheduler(sessionManager);
sessionManager.setDeleteInvalidSessions(shiroSessionProperties.isDeleteInvalidSessions());
sessionManager.setSessionValidationInterval(shiroSessionProperties.getValidationInterval());
sessionManager.setSessionValidationSchedulerEnabled(shiroSessionProperties.isValidationSchedulerEnabled());
sessionManager.setSessionValidationScheduler(scheduler);
return scheduler;
}
示例5: sessionManager
import org.apache.shiro.web.session.mgt.DefaultWebSessionManager; //导入方法依赖的package包/类
@Bean
public SessionManager sessionManager() {
DefaultWebSessionManager defaultWebSessionManager = new DefaultWebSessionManager();
defaultWebSessionManager.setGlobalSessionTimeout(Integer.valueOf(env.getProperty("session.max.age")) * 1000);
defaultWebSessionManager.setSessionValidationSchedulerEnabled(false);
// List<SessionListener> listenerList = new ArrayList<>();
// listenerList.add(sessionListener());
// defaultWebSessionManager.setSessionListeners(listenerList);
return defaultWebSessionManager;
}