当前位置: 首页>>代码示例>>Java>>正文


Java SessionCookieConfig.setHttpOnly方法代码示例

本文整理汇总了Java中javax.servlet.SessionCookieConfig.setHttpOnly方法的典型用法代码示例。如果您正苦于以下问题:Java SessionCookieConfig.setHttpOnly方法的具体用法?Java SessionCookieConfig.setHttpOnly怎么用?Java SessionCookieConfig.setHttpOnly使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.servlet.SessionCookieConfig的用法示例。


在下文中一共展示了SessionCookieConfig.setHttpOnly方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configureSessionCookie

import javax.servlet.SessionCookieConfig; //导入方法依赖的package包/类
private void configureSessionCookie(SessionCookieConfig config) {
	Cookie cookie = this.session.getCookie();
	if (cookie.getName() != null) {
		config.setName(cookie.getName());
	}
	if (cookie.getDomain() != null) {
		config.setDomain(cookie.getDomain());
	}
	if (cookie.getPath() != null) {
		config.setPath(cookie.getPath());
	}
	if (cookie.getComment() != null) {
		config.setComment(cookie.getComment());
	}
	if (cookie.getHttpOnly() != null) {
		config.setHttpOnly(cookie.getHttpOnly());
	}
	if (cookie.getSecure() != null) {
		config.setSecure(cookie.getSecure());
	}
	if (cookie.getMaxAge() != null) {
		config.setMaxAge(cookie.getMaxAge());
	}
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:25,代码来源:ServerProperties.java

示例2: servletContextInitializer

import javax.servlet.SessionCookieConfig; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Bean
public ServletContextInitializer servletContextInitializer() {
	return new ServletContextInitializer() {
		@Override
		public void onStartup(ServletContext servletContext) throws ServletException {
			servletContext.setSessionTrackingModes(Collections.singleton(SessionTrackingMode.COOKIE));
			SessionCookieConfig sessionCookieConfig = servletContext.getSessionCookieConfig();
			sessionCookieConfig.setHttpOnly(true);
		}
	};

}
 
开发者ID:rafaelrpinto,项目名称:VulnerableJavaWebApplication,代码行数:14,代码来源:AppLauncher.java

示例3: contextInitialized

import javax.servlet.SessionCookieConfig; //导入方法依赖的package包/类
@Override
public void contextInitialized(ServletContextEvent e) {
    System.setProperty(ApplicationConstants.CLIENT_DEFAULT_IMPL, ExtendedLinkedInApiClient.class.getName());

    DateTimeZone.setDefault(DateTimeZone.UTC);
    Locale.setDefault(Locale.ENGLISH);
    SessionCookieConfig sessionCookieConfig = e.getServletContext().getSessionCookieConfig();
    sessionCookieConfig.setHttpOnly(true);
    try {
        LogManager.getLogManager().readConfiguration(e.getServletContext().getResourceAsStream("/WEB-INF/classes/logging.properties"));
    } catch (IOException ex) {
        throw new IllegalStateException("Failed to initialize java.util.logging", ex);
    }
    ApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(e.getServletContext());
    Map<String, VideoExtractor> videoExtractors = ctx.getBeansOfType(VideoExtractor.class);
    WebUtils.videoExtractors.addAll(videoExtractors.values());

    Map<String, PictureProvider> pictureProviders = ctx.getBeansOfType(PictureProvider.class);
    WebUtils.pictureProviders.addAll(pictureProviders.values());

    Map<String, UrlShorteningService> urlShorteners = ctx.getBeansOfType(UrlShorteningService.class);
    WebUtils.urlShorteners.addAll(urlShorteners.values());

    initializeSocialNetworks(e.getServletContext());

    logger.info("Welshare startup successful");
}
 
开发者ID:Glamdring,项目名称:welshare,代码行数:28,代码来源:StartupListener.java

示例4: configureSessionCookie

import javax.servlet.SessionCookieConfig; //导入方法依赖的package包/类
private void configureSessionCookie(ServletContext servletContext) {
    SessionCookieConfig config = servletContext.getSessionCookieConfig();

    config.setHttpOnly(true);
    
    Validate.notNull(environment, "environment cannot be null!");
    // set secure cookie only if current environment doesn't strictly need HTTP
    config.setSecure(!environment.acceptsProfiles(PROFILE_HTTP));
    //
    

    // FIXME and CHECKME what a mess, ouch: https://issues.jboss.org/browse/WFLY-3448 ?
    config.setPath(servletContext.getContextPath() + "/");
    //
}
 
开发者ID:alfio-event,项目名称:alf.io,代码行数:16,代码来源:Initializer.java

示例5: setSessionConfig

import javax.servlet.SessionCookieConfig; //导入方法依赖的package包/类
@Override
public void setSessionConfig() {
    SessionManager sessionManager = webAppContext.getSessionHandler().getSessionManager();
    SessionCookieConfig sessionCookieConfig = sessionManager.getSessionCookieConfig();
    sessionCookieConfig.setHttpOnly(true);
    sessionCookieConfig.setSecure(systemEnvironment.isSessionCookieSecure());
    sessionCookieConfig.setMaxAge(systemEnvironment.sessionCookieMaxAgeInSeconds());
    sessionManager.setMaxInactiveInterval(systemEnvironment.sessionTimeoutInSeconds());
}
 
开发者ID:gocd,项目名称:gocd,代码行数:10,代码来源:Jetty9Server.java


注:本文中的javax.servlet.SessionCookieConfig.setHttpOnly方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。