javax.servlet.ServletContext.getSessionCookieConfig()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(130)

本文整理了Java中javax.servlet.ServletContext.getSessionCookieConfig()方法的一些代码示例,展示了ServletContext.getSessionCookieConfig()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ServletContext.getSessionCookieConfig()方法的具体详情如下:
包路径:javax.servlet.ServletContext
类名称:ServletContext
方法名:getSessionCookieConfig

ServletContext.getSessionCookieConfig介绍

暂无

代码示例

代码示例来源:origin: igniterealtime/Openfire

@Override
public SessionCookieConfig getSessionCookieConfig()
{
  return proxy.getSessionCookieConfig();
}

代码示例来源:origin: cloudfoundry/uaa

@Test
  public void verify_cookie_tracking_mode() throws Exception {
    ServletContext context = mock(ServletContext.class);
    UaaSessionCookieConfig config = new UaaSessionCookieConfig();
    SessionCookieConfig cookie = mock(SessionCookieConfig.class);
    when(context.getSessionCookieConfig()).thenReturn(cookie);
    config.setServletContext(context);
    ArgumentCaptor<Set<SessionTrackingMode>> tracking = ArgumentCaptor.forClass(Set.class);
    verify(context).setSessionTrackingModes(tracking.capture());
    assertThat(tracking.getValue(), containsInAnyOrder(SessionTrackingMode.COOKIE));
  }
}

代码示例来源:origin: org.springframework.boot/spring-boot

@Override
public void onStartup(ServletContext servletContext) throws ServletException {
  if (this.session.getTrackingModes() != null) {
    servletContext
        .setSessionTrackingModes(unwrap(this.session.getTrackingModes()));
  }
  configureSessionCookie(servletContext.getSessionCookieConfig());
}

代码示例来源:origin: cloudfoundry/uaa

@Test
public void testSetServletContext() throws Exception {
  ServletContext context = mock(ServletContext.class);
  UaaSessionCookieConfig config = new UaaSessionCookieConfig();
  SessionCookieConfig cookie = mock(SessionCookieConfig.class);
  when(context.getSessionCookieConfig()).thenReturn(cookie);
  doThrow(new IllegalStateException()).when(cookie).setHttpOnly(anyBoolean());
  config.setServletContext(context);
  verify(cookie, never()).setSecure(anyBoolean());
}

代码示例来源:origin: cloudfoundry/uaa

SessionCookieConfig config = servletContext.getSessionCookieConfig();
if (hasText(getComment())) {
  logger.debug(String.format("Configuring session cookie - Comment: %s", getComment()));

代码示例来源:origin: spring-projects/spring-session

SessionCookieConfig sessionCookieConfig = null;
try {
  sessionCookieConfig = this.servletContext.getSessionCookieConfig();

代码示例来源:origin: apache/felix

@Override
public SessionCookieConfig getSessionCookieConfig()
{
  return delegatee.getSessionCookieConfig();
}

代码示例来源:origin: apache/felix

@Override
public SessionCookieConfig getSessionCookieConfig()
{
  return this.context.getSessionCookieConfig();
}

代码示例来源:origin: org.apache.felix/org.apache.felix.http.base

@Override
public SessionCookieConfig getSessionCookieConfig()
{
  return this.context.getSessionCookieConfig();
}

代码示例来源:origin: apache/felix

@Override
public SessionCookieConfig getSessionCookieConfig()
{
  return this.context.getSessionCookieConfig();
}

代码示例来源:origin: apache/felix

@Override
public SessionCookieConfig getSessionCookieConfig() {
  return delegatee.getSessionCookieConfig();
}

代码示例来源:origin: psi-probe/psi-probe

servletContext.getSessionCookieConfig().setHttpOnly(true);

代码示例来源:origin: stackoverflow.com

public void contextInitialized(ServletContextEvent servletContextEvent) {
  ServletContext servletContext = servletContextEvent.getServletContext();
  SessionCookieConfig scc = servletContext.getSessionCookieConfig();
  scc.setSecure(true);
}

代码示例来源:origin: org.apache.openejb/openejb-core

@Override
public SessionCookieConfig getSessionCookieConfig() {
  return get().getSessionCookieConfig();
}

代码示例来源:origin: OpenConext/Mujina

@Bean
public ServletContextInitializer servletContextInitializer() {
 //otherwise the two localhost instances override each other session
 return servletContext -> servletContext.getSessionCookieConfig().setName("mujinaIdpSessionId");
}

代码示例来源:origin: apache/cxf

public SessionCookieConfig getSessionCookieConfig() {
  return get().getSessionCookieConfig();
}

代码示例来源:origin: org.eclipse.scout.rt/org.eclipse.scout.rt.ui.html

@Override
public void init(ServletConfig config) throws ServletException {
 super.init(config);
 checkSessionCookieConfig(config.getServletContext().getSessionCookieConfig());
}

代码示例来源:origin: stackoverflow.com

@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);
         }
       };
   }

代码示例来源:origin: org.apache.wicket/wicket-core

/**
 * Gets the name of the cookie where the session id is stored.
 *
 * @param application
 *            The current we application holding the {@link javax.servlet.ServletContext}.
 *
 * @return The name set in {@link javax.servlet.SessionCookieConfig} or the default value 'JSESSIONID' if not set
 */
public String getSessionIdCookieName(WebApplication application)
{
  String jsessionCookieName = application.getServletContext().getSessionCookieConfig().getName();
  return jsessionCookieName == null ? DEFAULT_SESSIONID_COOKIE_NAME : jsessionCookieName;
}

代码示例来源:origin: ldp4j/ldp4j

static String dumpContext(String event, ServletContext context) {
  Map<String,Object> messages=new TreeMap<String,Object>();
  addMetadataMessages(context, messages);
  addEfectiveSessionTrackingModeMessages(messages, context.getEffectiveSessionTrackingModes());
  addAttributeMessages(context, messages);
  addInitParameterMessages(context, messages);
  addSessionCookieConfigMessages(messages, context.getSessionCookieConfig());
  addServletRegistrationMessages(messages, context.getServletRegistrations());
  return assembleMessages(event, messages);
}

相关文章

微信公众号

最新文章

更多

ServletContext类方法