org.eclipse.jetty.server.session.SessionHandler#setMaxInactiveInterval ( )源码实例Demo

下面列出了org.eclipse.jetty.server.session.SessionHandler#setMaxInactiveInterval ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: commafeed   文件: SessionHandlerFactory.java
public SessionHandler build() {
	SessionHandler sessionHandler = new SessionHandler() {
		{
			// no setter available for maxCookieAge
			_maxCookieAge = (int) cookieMaxAge.toSeconds();
		}
	};
	SessionCache sessionCache = new DefaultSessionCache(sessionHandler);
	sessionHandler.setSessionCache(sessionCache);
	FileSessionDataStore dataStore = new FileSessionDataStore();
	sessionCache.setSessionDataStore(dataStore);

	sessionHandler.setHttpOnly(true);
	sessionHandler.setSessionTrackingModes(ImmutableSet.of(SessionTrackingMode.COOKIE));
	sessionHandler.setMaxInactiveInterval((int) maxInactiveInterval.toSeconds());
	sessionHandler.setRefreshCookieAge((int) cookieRefreshAge.toSeconds());

	dataStore.setDeleteUnrestorableFiles(true);
	dataStore.setStoreDir(new File(path));
	dataStore.setSavePeriodSec((int) savePeriod.toSeconds());

	return sessionHandler;
}
 
源代码2 项目: gocd   文件: Jetty9Server.java
@Override
public void setSessionConfig() {
    SessionHandler sessionHandler = webAppContext.getSessionHandler();
    SessionCookieConfig sessionCookieConfig = sessionHandler.getSessionCookieConfig();
    sessionCookieConfig.setHttpOnly(true);
    sessionCookieConfig.setSecure(systemEnvironment.isSessionCookieSecure());
    sessionCookieConfig.setMaxAge(systemEnvironment.sessionCookieMaxAgeInSeconds());
    sessionHandler.setMaxInactiveInterval(systemEnvironment.sessionTimeoutInSeconds());
}