org.apache.catalina.Context.getSessionCookie()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(97)

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

Context.getSessionCookie介绍

[英]Return the session cookie configuration.
[中]返回会话cookie配置。

代码示例

代码示例来源:origin: org.jboss.web/jbossweb

sb.append(request.getContext().getSessionCookie().getPathParameterName());
sb.append(sessionId);

代码示例来源:origin: jboss.web/jbossweb

cookie.setMaxAge(context.getSessionCookie().getMaxAge());
if (context.getSessionCookie().getPath() != null) {
  cookie.setPath(context.getSessionCookie().getPath());
} else {
  String contextPath = context.getEncodedPath();
if (context.getSessionCookie().getComment() != null) {
  cookie.setComment(context.getSessionCookie().getComment());
if (context.getSessionCookie().getDomain() != null) {
  cookie.setDomain(context.getSessionCookie().getDomain());
if (context.getSessionCookie().isHttpOnly()) {
  cookie.setHttpOnly(true);
if (context.getSessionCookie().isSecure()) {
  cookie.setSecure(true);
} else if (isSecure()) {

代码示例来源:origin: org.jboss.web/jbossweb

cookie.setMaxAge(context.getSessionCookie().getMaxAge());
if (context.getSessionCookie().getPath() != null) {
  cookie.setPath(context.getSessionCookie().getPath());
} else {
  String contextPath = context.getEncodedPath();
if (context.getSessionCookie().getComment() != null) {
  cookie.setComment(context.getSessionCookie().getComment());
if (context.getSessionCookie().getDomain() != null) {
  cookie.setDomain(context.getSessionCookie().getDomain());
if (context.getSessionCookie().isHttpOnly()) {
  cookie.setHttpOnly(true);
if (context.getSessionCookie().isSecure()) {
  cookie.setSecure(true);
} else if (isSecure()) {

代码示例来源:origin: org.jboss.jbossas/jboss-as-tomcat

if (context.getSessionCookie().getPath() != null)
  cookie.setPath(context.getSessionCookie().getPath());
if (context.getSessionCookie().getComment() != null)
  cookie.setComment(context.getSessionCookie().getComment());
if (context.getSessionCookie().getDomain() != null)
  cookie.setDomain(context.getSessionCookie().getDomain());
if (context.getSessionCookie().isHttpOnly())
if (context.getSessionCookie().isSecure())

代码示例来源:origin: org.jboss.web/jbossweb

/**
 * Change the ID of the session that this request is associated with. There
 * are several things that may trigger an ID change. These include mmoving
 * between nodes in a cluster and session fixation prevention during the
 * authentication process.
 * 
 * @param session   The session to change the session ID for
 */
public void changeSessionId(String newSessionId) {
  // This should only ever be called if there was an old session ID but
  // double check to be sure
  if (requestedSessionId != null && requestedSessionId.length() > 0) {
    requestedSessionId = newSessionId;
  }
  
  if (context != null && !context.getServletContext()
      .getEffectiveSessionTrackingModes().contains(
          SessionTrackingMode.COOKIE))
    return;
  
  if (response != null) {
    Cookie cookie = new Cookie(context.getSessionCookie().getName(), newSessionId);
    configureSessionCookie(cookie);
    response.addCookieInternal(cookie);
  }
}

代码示例来源:origin: jboss.web/jbossweb

/**
 * Change the ID of the session that this request is associated with. There
 * are several things that may trigger an ID change. These include mmoving
 * between nodes in a cluster and session fixation prevention during the
 * authentication process.
 * 
 * @param session   The session to change the session ID for
 */
public void changeSessionId(String newSessionId) {
  // This should only ever be called if there was an old session ID but
  // double check to be sure
  if (requestedSessionId != null && requestedSessionId.length() > 0) {
    requestedSessionId = newSessionId;
  }
  
  if (context != null && !context.getServletContext()
      .getEffectiveSessionTrackingModes().contains(
          SessionTrackingMode.COOKIE))
    return;
  
  if (response != null) {
    String cookieName = context.getSessionCookie().getName();
    if (cookieName == null) {
      cookieName = Globals.SESSION_COOKIE_NAME;
    }
    Cookie cookie = new Cookie(cookieName, newSessionId);
    configureSessionCookie(cookie);
    response.addCookieInternal(cookie);
  }
}

代码示例来源:origin: org.jboss.web/jbossweb

if (file == null)
  return (false);
String tok = request.getContext().getSessionCookie().getPathParameterName() + session.getIdInternal();
if (file.indexOf(tok) >= 0)
  return (false);

代码示例来源:origin: org.jboss.web/jbossweb

if ((requestedSessionId != null) &&
  request.isRequestedSessionIdFromURL()) {
  file.append(request.getContext().getSessionCookie().getPathParameterName());
  file.append(requestedSessionId);

代码示例来源:origin: org.jboss.web/jbossweb

String pathParameterName = request.getContext().getSessionCookie().getPathParameterName();
int semicolon = uriBC.indexOf(pathParameterName, 0, pathParameterName.length(), 0);

代码示例来源:origin: jboss.web/jbossweb

String cookieName = context.getSessionCookie().getName();
if (cookieName == null) {
  cookieName = Globals.SESSION_COOKIE_NAME;

代码示例来源:origin: org.jboss.web/jbossweb

Cookie cookie = new Cookie(context.getSessionCookie().getName(), session.getIdInternal());
configureSessionCookie(cookie);
response.addCookieInternal(cookie);

代码示例来源:origin: org.jboss.web/jbossweb

/**
 * Parse session id in URL.
 */
protected void parseSessionCookiesId(org.apache.coyote.Request req, Request request) {
  // Parse session id from cookies
  Cookies serverCookies = req.getCookies();
  int count = serverCookies.getCookieCount();
  if (count <= 0)
    return;
  String cookieName = request.getContext().getSessionCookie().getName();
  for (int i = 0; i < count; i++) {
    ServerCookie scookie = serverCookies.getCookie(i);
    if (scookie.getName().equals(cookieName)) {
      // Override anything requested in the URL
      if (!request.isRequestedSessionIdFromCookie()) {
        // Accept only the first session id cookie
        convertMB(scookie.getValue());
        request.setRequestedSessionId(scookie.getValue().toString());
        request.setRequestedSessionCookie(true);
        request.setRequestedSessionURL(false);
      } else {
        if (!isSessionIdValid(request, request.getRequestedSessionId())) {
          // Replace the session id until one is valid
          convertMB(scookie.getValue());
          request.setRequestedSessionId(scookie.getValue().toString());
        }
      }
    }
  }
}

代码示例来源:origin: org.jboss.web/jbossweb

redirectPath = redirectPath + request.getContext().getSessionCookie().getPathParameterName()
  + request.getRequestedSessionId();

相关文章

微信公众号

最新文章

更多

Context类方法