org.eclipse.jetty.client.api.Request.getCookies()方法的使用及代码示例

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

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

Request.getCookies介绍

暂无

代码示例

代码示例来源:origin: apache/incubator-druid

@Override
public void decorateProxyRequest(
  HttpServletRequest clientRequest,
  HttpServletResponse proxyResponse,
  Request proxyRequest
)
{
 Object cookieToken = clientRequest.getAttribute(SIGNED_TOKEN_ATTRIBUTE);
 if (cookieToken != null && cookieToken instanceof String) {
  log.debug("Found cookie token will attache it to proxyRequest as cookie");
  String authResult = (String) cookieToken;
  String existingCookies = proxyRequest.getCookies()
                     .stream()
                     .map(HttpCookie::toString)
                     .collect(Collectors.joining(";"));
  proxyRequest.header(HttpHeader.COOKIE, Joiner.on(";").join(authResult, existingCookies));
 }
}

代码示例来源:origin: isucon/isucon5-final

public void writeCookie(Request req) {
  List<HttpCookie> existing = req.getCookies();
  synchronized(cookies) {
    for (HttpCookie cookie : cookies) {
      boolean exists = false;
      for (HttpCookie e : existing) {
        if (e.getName().equals(cookie.getName())) {
          e.setValue(cookie.getValue());
          exists = true;
          break;
        }
      }
      if (! exists) {
        req.cookie(cookie);
      }
    }
  }
}

代码示例来源:origin: isucon/isucon5-qualify

public void writeCookie(Request req) {
 List<HttpCookie> existing = req.getCookies();
 synchronized(cookies) {
  for (HttpCookie cookie : cookies) {
   boolean exists = false;
   for (HttpCookie e : existing) {
    if (e.getName().equals(cookie.getName())) {
     e.setValue(cookie.getValue());
     exists = true;
     break;
    }
   }
   if (! exists) {
    req.cookie(cookie);
   }
  }
 }
}

代码示例来源:origin: org.eclipse.jetty/jetty-client

if (uri != null)
  cookies = convertCookies(HttpCookieStore.matchPath(uri, cookieStore.get(uri)), null);
cookies = convertCookies(request.getCookies(), cookies);
if (cookies != null)
  request.header(HttpHeader.COOKIE.asString(), cookies.toString());

相关文章