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

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

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

Context.getCookies介绍

[英]Return the "use cookies for session ids" flag.
[中]返回“将cookies用于会话ID”标志。

代码示例

代码示例来源:origin: org.apache.geronimo.modules/geronimo-tomcat7-clustering-wadi

protected void setNewSessionCookie(Request request, Response response, String augmentedSessionID) {
  Context context = request.getContext();
  if (context.getCookies()) {
    Cookie newCookie = new Cookie(ApplicationSessionCookieConfig.getSessionCookieName(request.getContext()), augmentedSessionID);
    newCookie.setMaxAge(-1);
    String contextPath = null;
    if (context != null && context.getSessionCookiePath() != null) {
      contextPath = context.getSessionCookiePath();
    }
    if ((contextPath != null) && (contextPath.length() > 0)) {
      newCookie.setPath(contextPath);
    } else {
      newCookie.setPath("/");
    }
    if (request.isSecure()) {
      newCookie.setSecure(true);
    }
    response.addCookie(newCookie);
  }
}

代码示例来源:origin: org.glassfish.main.web/web-core

private void addSessionCookie() {
  if (context != null && context.getCookies() && response != null) {
    String jvmRoute = ((StandardContext) getContext()).getJvmRoute();
    /*
     * Check if context has been configured with jvmRoute for
     * Apache LB. If it has, do not add the JSESSIONID cookie
     * here, but rely on OutputBuffer#addSessionCookieWithJvmRoute
     * to add the jvmRoute enhanced JSESSIONID as a cookie right
     * before the response is flushed.
     */
    if (jvmRoute == null) {
      Cookie newCookie = new Cookie(
          getSafeHeaderValue(getContext().getSessionCookieName()), getSafeHeaderValue(session.getId()));
      configureSessionCookie(newCookie);
      ((HttpResponse)response).addSessionCookieInternal(newCookie);
    }
  }
}

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

if (context.getCookies())

代码示例来源:origin: tomcat/catalina

return (null);
if ((context != null) && (response != null) &&
  context.getCookies() &&
  response.getResponse().isCommitted()) {
  throw new IllegalStateException
    && getContext().getCookies()) {
  Cookie cookie = new Cookie(Globals.SESSION_COOKIE_NAME,
                session.getIdInternal());

代码示例来源:origin: org.osivia.portal.core/osivia-portal-jbossas-jbossweb-lib

/* 2298 */     if ((this.context != null) && (this.response != null) && (this.context.getCookies()) && (this.response.getResponse().isCommitted()))
/* 2316 */     if ((this.session != null) && (getContext() != null) && (getContext().getCookies()))

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

return (null);
if ((response != null) &&
  context.getCookies() &&
  response.getResponse().isCommitted()) {
  throw new IllegalStateException
if ( (session != null) && context.getCookies()
    && !(isRequestedSessionIdFromCookie() && (session.getIdInternal().equals(getRequestedSessionId()))) ) {
  String cookieName = context.getSessionCookie().getName();

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

return (null);
if ((response != null) &&
  context.getCookies() &&
  response.getResponse().isCommitted()) {
  throw MESSAGES.cannotCreateSession();
if ( (session != null) && context.getCookies()
    && !(isRequestedSessionIdFromCookie() && (session.getIdInternal().equals(getRequestedSessionId()))) ) {
  Cookie cookie = new Cookie(context.getSessionCookie().getName(), session.getIdInternal());

代码示例来源:origin: org.glassfish.main.web/web-core

if (context != null && !context.getCookies()) {
  return;

代码示例来源:origin: org.glassfish.main.web/web-core

context.getCookies() &&
  response.getResponse().isCommitted()) {
throw new IllegalStateException(rb.getString(LogFacade.CANNOT_CREATE_SESSION_EXCEPTION));

相关文章

微信公众号

最新文章

更多

Context类方法