org.apache.catalina.connector.Response.generateCookieString()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(10.6k)|赞(0)|评价(0)|浏览(114)

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

Response.generateCookieString介绍

暂无

代码示例

代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9

/**
 * Add the specified Cookie to those that will be included with
 * this Response.
 *
 * @param cookie Cookie to be added
 */
@Override
public void addCookie(final Cookie cookie) {
  // Ignore any call from an included servlet
  if (included || isCommitted())
    return;
  final StringBuffer sb = generateCookieString(cookie);
  //if we reached here, no exception, cookie is valid
  // the header name is Set-Cookie for both "old" and v.1 ( RFC2109 )
  // RFC2965 is not supported by browsers and the Servlet spec
  // asks for 2109.
  addHeader("Set-Cookie", sb.toString());
}

代码示例来源:origin: codefollower/Tomcat-Research

/**
 * Add the specified Cookie to those that will be included with
 * this Response.
 *
 * @param cookie Cookie to be added
 */
@Override
public void addCookie(final Cookie cookie) {
  // Ignore any call from an included servlet
  if (included || isCommitted()) {
    return;
  }
  final StringBuffer sb = generateCookieString(cookie);
  //if we reached here, no exception, cookie is valid
  // the header name is Set-Cookie for both "old" and v.1 ( RFC2109 )
  // RFC2965 is not supported by browsers and the Servlet spec
  // asks for 2109.
  addHeader("Set-Cookie", sb.toString());
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7

/**
 * Add the specified Cookie to those that will be included with
 * this Response.
 *
 * @param cookie Cookie to be added
 */
@Override
public void addCookie(final Cookie cookie) {
  // Ignore any call from an included servlet
  if (included || isCommitted())
    return;
  final StringBuffer sb = generateCookieString(cookie);
  //if we reached here, no exception, cookie is valid
  // the header name is Set-Cookie for both "old" and v.1 ( RFC2109 )
  // RFC2965 is not supported by browsers and the Servlet spec
  // asks for 2109.
  addHeader("Set-Cookie", sb.toString());
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9

/**
 * Add the specified Cookie to those that will be included with
 * this Response.
 *
 * @param cookie Cookie to be added
 */
@Override
public void addCookie(final Cookie cookie) {
  // Ignore any call from an included servlet
  if (included || isCommitted())
    return;
  final StringBuffer sb = generateCookieString(cookie);
  //if we reached here, no exception, cookie is valid
  // the header name is Set-Cookie for both "old" and v.1 ( RFC2109 )
  // RFC2965 is not supported by browsers and the Servlet spec
  // asks for 2109.
  addHeader("Set-Cookie", sb.toString());
}

代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina

/**
 * Add the specified Cookie to those that will be included with
 * this Response.
 *
 * @param cookie Cookie to be added
 */
@Override
public void addCookie(final Cookie cookie) {
  // Ignore any call from an included servlet
  if (included || isCommitted()) {
    return;
  }
  final StringBuffer sb = generateCookieString(cookie);
  //if we reached here, no exception, cookie is valid
  // the header name is Set-Cookie for both "old" and v.1 ( RFC2109 )
  // RFC2965 is not supported by browsers and the Servlet spec
  // asks for 2109.
  addHeader("Set-Cookie", sb.toString());
}

代码示例来源:origin: org.apache.catalina/com.springsource.org.apache.catalina

/**
 * Add the specified Cookie to those that will be included with
 * this Response.
 *
 * @param cookie Cookie to be added
 */
@Override
public void addCookie(final Cookie cookie) {
  // Ignore any call from an included servlet
  if (included || isCommitted()) {
    return;
  }
  final StringBuffer sb = generateCookieString(cookie);
  //if we reached here, no exception, cookie is valid
  // the header name is Set-Cookie for both "old" and v.1 ( RFC2109 )
  // RFC2965 is not supported by browsers and the Servlet spec
  // asks for 2109.
  addHeader("Set-Cookie", sb.toString());
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

/**
 * Add the specified Cookie to those that will be included with
 * this Response.
 *
 * @param cookie Cookie to be added
 */
@Override
public void addCookie(final Cookie cookie) {
  // Ignore any call from an included servlet
  if (included || isCommitted()) {
    return;
  }
  cookies.add(cookie);
  String header = generateCookieString(cookie);
  //if we reached here, no exception, cookie is valid
  // the header name is Set-Cookie for both "old" and v.1 ( RFC2109 )
  // RFC2965 is not supported by browsers and the Servlet spec
  // asks for 2109.
  addHeader("Set-Cookie", header, getContext().getCookieProcessor().getCharset());
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

/**
 * Add the specified Cookie to those that will be included with
 * this Response.
 *
 * @param cookie Cookie to be added
 */
@Override
public void addCookie(final Cookie cookie) {
  // Ignore any call from an included servlet
  if (included || isCommitted()) {
    return;
  }
  cookies.add(cookie);
  String header = generateCookieString(cookie);
  //if we reached here, no exception, cookie is valid
  // the header name is Set-Cookie for both "old" and v.1 ( RFC2109 )
  // RFC2965 is not supported by browsers and the Servlet spec
  // asks for 2109.
  addHeader("Set-Cookie", header, getContext().getCookieProcessor().getCharset());
}

代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9

/**
 * Special method for adding a session cookie as we should be overriding 
 * any previous 
 * @param cookie
 */
public void addSessionCookieInternal(final Cookie cookie) {
  if (isCommitted())
    return;
  
  String name = cookie.getName();
  final String headername = "Set-Cookie";
  final String startsWith = name + "=";
  final StringBuffer sb = generateCookieString(cookie);
  boolean set = false;
  MimeHeaders headers = coyoteResponse.getMimeHeaders();
  int n = headers.size();
  for (int i = 0; i < n; i++) {
    if (headers.getName(i).toString().equals(headername)) {
      if (headers.getValue(i).toString().startsWith(startsWith)) {
        headers.getValue(i).setString(sb.toString());
        set = true;
      }
    }
  }
  if (!set) {
    addHeader(headername, sb.toString());
  }
  
  
}

代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina

/**
 * Special method for adding a session cookie as we should be overriding
 * any previous
 * @param cookie
 */
public void addSessionCookieInternal(final Cookie cookie) {
  if (isCommitted()) {
    return;
  }
  String name = cookie.getName();
  final String headername = "Set-Cookie";
  final String startsWith = name + "=";
  final StringBuffer sb = generateCookieString(cookie);
  boolean set = false;
  MimeHeaders headers = coyoteResponse.getMimeHeaders();
  int n = headers.size();
  for (int i = 0; i < n; i++) {
    if (headers.getName(i).toString().equals(headername)) {
      if (headers.getValue(i).toString().startsWith(startsWith)) {
        headers.getValue(i).setString(sb.toString());
        set = true;
      }
    }
  }
  if (!set) {
    addHeader(headername, sb.toString());
  }
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7

/**
 * Special method for adding a session cookie as we should be overriding 
 * any previous 
 * @param cookie
 */
public void addSessionCookieInternal(final Cookie cookie) {
  if (isCommitted())
    return;
  
  String name = cookie.getName();
  final String headername = "Set-Cookie";
  final String startsWith = name + "=";
  final StringBuffer sb = generateCookieString(cookie);
  boolean set = false;
  MimeHeaders headers = coyoteResponse.getMimeHeaders();
  int n = headers.size();
  for (int i = 0; i < n; i++) {
    if (headers.getName(i).toString().equals(headername)) {
      if (headers.getValue(i).toString().startsWith(startsWith)) {
        headers.getValue(i).setString(sb.toString());
        set = true;
      }
    }
  }
  if (!set) {
    addHeader(headername, sb.toString());
  }
  
  
}

代码示例来源:origin: codefollower/Tomcat-Research

/**
 * Special method for adding a session cookie as we should be overriding
 * any previous
 * @param cookie
 */
public void addSessionCookieInternal(final Cookie cookie) {
  if (isCommitted()) {
    return;
  }
  String name = cookie.getName();
  final String headername = "Set-Cookie";
  final String startsWith = name + "=";
  final StringBuffer sb = generateCookieString(cookie);
  boolean set = false;
  MimeHeaders headers = coyoteResponse.getMimeHeaders();
  int n = headers.size();
  for (int i = 0; i < n; i++) {
    if (headers.getName(i).toString().equals(headername)) {
      if (headers.getValue(i).toString().startsWith(startsWith)) {
        headers.getValue(i).setString(sb.toString());
        set = true;
      }
    }
  }
  if (!set) {
    addHeader(headername, sb.toString());
  }
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9

/**
 * Special method for adding a session cookie as we should be overriding 
 * any previous 
 * @param cookie
 */
public void addSessionCookieInternal(final Cookie cookie) {
  if (isCommitted())
    return;
  
  String name = cookie.getName();
  final String headername = "Set-Cookie";
  final String startsWith = name + "=";
  final StringBuffer sb = generateCookieString(cookie);
  boolean set = false;
  MimeHeaders headers = coyoteResponse.getMimeHeaders();
  int n = headers.size();
  for (int i = 0; i < n; i++) {
    if (headers.getName(i).toString().equals(headername)) {
      if (headers.getValue(i).toString().startsWith(startsWith)) {
        headers.getValue(i).setString(sb.toString());
        set = true;
      }
    }
  }
  if (!set) {
    addHeader(headername, sb.toString());
  }
  
  
}

代码示例来源:origin: org.apache.catalina/com.springsource.org.apache.catalina

/**
 * Special method for adding a session cookie as we should be overriding
 * any previous
 * @param cookie
 */
public void addSessionCookieInternal(final Cookie cookie) {
  if (isCommitted()) {
    return;
  }
  String name = cookie.getName();
  final String headername = "Set-Cookie";
  final String startsWith = name + "=";
  final StringBuffer sb = generateCookieString(cookie);
  boolean set = false;
  MimeHeaders headers = coyoteResponse.getMimeHeaders();
  int n = headers.size();
  for (int i = 0; i < n; i++) {
    if (headers.getName(i).toString().equals(headername)) {
      if (headers.getValue(i).toString().startsWith(startsWith)) {
        headers.getValue(i).setString(sb.toString());
        set = true;
      }
    }
  }
  if (!set) {
    addHeader(headername, sb.toString());
  }
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

/**
 * Special method for adding a session cookie as we should be overriding
 * any previous.
 *
 * @param cookie The new session cookie to add the response
 */
public void addSessionCookieInternal(final Cookie cookie) {
  if (isCommitted()) {
    return;
  }
  String name = cookie.getName();
  final String headername = "Set-Cookie";
  final String startsWith = name + "=";
  String header = generateCookieString(cookie);
  boolean set = false;
  MimeHeaders headers = getCoyoteResponse().getMimeHeaders();
  int n = headers.size();
  for (int i = 0; i < n; i++) {
    if (headers.getName(i).toString().equals(headername)) {
      if (headers.getValue(i).toString().startsWith(startsWith)) {
        headers.getValue(i).setString(header);
        set = true;
      }
    }
  }
  if (!set) {
    addHeader(headername, header);
  }
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

/**
 * Special method for adding a session cookie as we should be overriding
 * any previous.
 *
 * @param cookie The new session cookie to add the response
 */
public void addSessionCookieInternal(final Cookie cookie) {
  if (isCommitted()) {
    return;
  }
  String name = cookie.getName();
  final String headername = "Set-Cookie";
  final String startsWith = name + "=";
  String header = generateCookieString(cookie);
  boolean set = false;
  MimeHeaders headers = getCoyoteResponse().getMimeHeaders();
  int n = headers.size();
  for (int i = 0; i < n; i++) {
    if (headers.getName(i).toString().equals(headername)) {
      if (headers.getValue(i).toString().startsWith(startsWith)) {
        headers.getValue(i).setString(header);
        set = true;
      }
    }
  }
  if (!set) {
    addHeader(headername, header);
  }
}

相关文章

Response类方法