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

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

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

Request.getAttributes介绍

暂无

代码示例

代码示例来源:origin: resteasy/Resteasy

private void configureTimeout(final Request request) {
 final Object timeout = request.getAttributes().get(REQUEST_TIMEOUT_MS);
 final long timeoutMs;
 if (timeout instanceof Duration) {
   timeoutMs = ((Duration) timeout).toMillis();
 } else if (timeout instanceof Number) {
   timeoutMs = ((Number) timeout).intValue();
 } else if (timeout != null) {
   timeoutMs = Integer.parseInt(timeout.toString());
 } else {
   timeoutMs = -1;
 }
 if (timeoutMs > 0) {
   request.timeout(timeoutMs, TimeUnit.MILLISECONDS);
 }
}

代码示例来源:origin: resteasy/Resteasy

invocation.getHeaders().asMap().forEach((h, vs) -> vs.forEach(v -> request.header(h, v)));
configureTimeout(request);
if (request.getAttributes().get(FOLLOW_REDIRECTS) == Boolean.FALSE) {
  request.followRedirects(false);

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

private static boolean isPreserveAuthorization(Request request)
  {
    return (boolean) request.getAttributes().get(PRESERVE_AUTHORIZATION_KEY);
  }
}

代码示例来源:origin: com.proofpoint.platform/http-client

private static boolean isPreserveAuthorization(Request request)
  {
    return (boolean) request.getAttributes().get(PRESERVE_AUTHORIZATION_KEY);
  }
}

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

static List<JettyRequestListener> getRequestListenersForDestination(Destination destination)
{
  return getRequestForDestination(destination).stream()
      .map(request -> request.getAttributes().get(STATS_KEY))
      .map(JettyRequestListener.class::cast)
      .filter(Objects::nonNull)
      .collect(Collectors.toList());
}

代码示例来源:origin: com.proofpoint.platform/http-client

static List<JettyRequestListener> getRequestListenersForDestination(Destination destination)
{
  return getRequestForDestination(destination).stream()
      .map(request -> request.getAttributes().get(PLATFORM_STATS_KEY))
      .map(JettyRequestListener.class::cast)
      .filter(Objects::nonNull)
      .collect(Collectors.toList());
}

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

@Override
  protected void onContinue(Request request)
  {
    HttpServletRequest clientRequest = (HttpServletRequest)request.getAttributes().get(CLIENT_REQUEST_ATTRIBUTE);
    AbstractProxyServlet.this.onContinue(clientRequest, request);
  }
}

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

@Override
protected void onContinue(HttpServletRequest clientRequest, Request proxyRequest)
{
  super.onContinue(clientRequest, proxyRequest);
  Runnable action = (Runnable)proxyRequest.getAttributes().get(CONTINUE_ACTION_ATTRIBUTE);
  action.run();
}

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

@Override
protected void onContinue(HttpServletRequest clientRequest, Request proxyRequest)
{
  super.onContinue(clientRequest, proxyRequest);
  Runnable action = (Runnable)proxyRequest.getAttributes().get(CONTINUE_ACTION_ATTRIBUTE);
  Executor executor = getHttpClient().getExecutor();
  executor.execute(action);
}

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

@Override
public boolean accept(Request request, Response response)
{
  boolean is100 = response.getStatus() == HttpStatus.CONTINUE_100;
  boolean expect100 = request.getHeaders().contains(HttpHeader.EXPECT, HttpHeaderValue.CONTINUE.asString());
  boolean handled100 = request.getAttributes().containsKey(ATTRIBUTE);
  return (is100 || expect100) && !handled100;
}

相关文章