org.apache.http.HttpRequest.getAllHeaders()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(187)

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

HttpRequest.getAllHeaders介绍

暂无

代码示例

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

@Override
public void sendRequestHeader(HttpRequest request) throws HttpException, IOException {
  super.sendRequestHeader(request);
  if (headerLog.isDebugEnabled()) {
    headerLog.debug(">> " + request.getRequestLine().toString());
    Header[] headers = request.getAllHeaders();
    for (Header header : headers) {
      headerLog.debug(">> " + header.toString());
    }
  }
}

代码示例来源:origin: square/okhttp

for (Header header : request.getAllHeaders()) {
 String name = header.getName();
 if ("Content-Type".equalsIgnoreCase(name)) {

代码示例来源:origin: wiztools/rest-client

static String getHTTPRequestTrace(HttpRequest request) {
  StringBuilder sb = new StringBuilder();
  sb.append(request.getRequestLine());
  sb.append('\n');
  for (Header h : request.getAllHeaders()) {
    sb.append(h.getName()).append(": ").append(h.getValue()).append('\n');
  }
  sb.append('\n');
  // Check if the request is POST or PUT
  if (request instanceof HttpEntityEnclosingRequest) {
    HttpEntityEnclosingRequest r = (HttpEntityEnclosingRequest) request;
    HttpEntity e = r.getEntity();
    if (e != null) {
      appendHttpEntity(sb, e);
    }
  }
  return sb.toString();
}

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

public void resetHeaders() {
  // Make a copy of original headers
  this.headergroup.clear();
  setHeaders(this.original.getAllHeaders());
}

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

for (Header header : request.getAllHeaders()) {
 actualRequestHeaders.put(header.getName(), header.getValue());

代码示例来源:origin: fabric8io/docker-maven-plugin

AwsSigner4Request(String region, String service, HttpRequest request, Date signingTime) {
  this.region = region;
  this.service = service;
  this.request = request;
  signingDateTime = getSigningDateTime(request, signingTime);
  signingDate = signingDateTime.substring(0, 8);
  scope = signingDate + '/' + region + '/' + service + "/aws4_request";
  method = request.getRequestLine().getMethod();
  uri = getUri(request);
  Map<String, String> headers = getOrderedHeadersToSign(request.getAllHeaders());
  signedHeaders = StringUtils.join(headers.keySet(), ';');
  canonicalHeaders = canonicalHeaders(headers);
}

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

redirect.setHeaders(orig.getAllHeaders());

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

redirect.setHeaders(orig.getAllHeaders());

代码示例来源:origin: io.opentracing.contrib/opentracing-elasticsearch-client-common

public HttpTextMapExtractAdapter(HttpRequest request) {
 for (Header header : request.getAllHeaders()) {
  map.put(header.getName(), header.getValue());
 }
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

@Override
public void sendRequestHeader(HttpRequest request) throws HttpException, IOException {
  super.sendRequestHeader(request);
  if (headerLog.isDebugEnabled()) {
    headerLog.debug(">> " + request.getRequestLine().toString());
    Header[] headers = request.getAllHeaders();
    for (Header header : headers) {
      headerLog.debug(">> " + header.toString());
    }
  }
}

代码示例来源:origin: com.gluonhq/robovm-rt

@Override
public void sendRequestHeader(HttpRequest request) throws HttpException, IOException {
  super.sendRequestHeader(request);
  if (headerLog.isDebugEnabled()) {
    headerLog.debug(">> " + request.getRequestLine().toString());
    Header[] headers = request.getAllHeaders();
    for (Header header : headers) {
      headerLog.debug(">> " + header.toString());
    }
  }
}

代码示例来源:origin: MobiVM/robovm

@Override
public void sendRequestHeader(HttpRequest request) throws HttpException, IOException {
  super.sendRequestHeader(request);
  if (headerLog.isDebugEnabled()) {
    headerLog.debug(">> " + request.getRequestLine().toString());
    Header[] headers = request.getAllHeaders();
    for (Header header : headers) {
      headerLog.debug(">> " + header.toString());
    }
  }
}

代码示例来源:origin: ibinti/bugvm

@Override
protected void onRequestSubmitted(final HttpRequest request) {
  if (request != null && this.headerlog.isDebugEnabled()) {
    this.headerlog.debug(getId() + " >> " + request.getRequestLine().toString());
    final Header[] headers = request.getAllHeaders();
    for (final Header header : headers) {
      this.headerlog.debug(getId() + " >> " + header.toString());
    }
  }
}

代码示例来源:origin: org.apache.httpcomponents/httpclient-android

@Override
protected void onRequestSubmitted(final HttpRequest request) {
  if (request != null && Log.isLoggable(HEADER_TAG, Log.DEBUG)) {
    Log.d(HEADER_TAG, getId() + " >> " + request.getRequestLine().toString());
    final Header[] headers = request.getAllHeaders();
    for (final Header header : headers) {
      Log.d(HEADER_TAG, getId() + " >> " + header.toString());
    }
  }
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

@Override
protected void onRequestSubmitted(final HttpRequest request) {
  if (request != null && this.headerlog.isDebugEnabled()) {
    this.headerlog.debug(getId() + " >> " + request.getRequestLine().toString());
    final Header[] headers = request.getAllHeaders();
    for (final Header header : headers) {
      this.headerlog.debug(getId() + " >> " + header.toString());
    }
  }
}

代码示例来源:origin: com.bugvm/bugvm-rt

@Override
protected void onRequestSubmitted(final HttpRequest request) {
  if (request != null && this.headerlog.isDebugEnabled()) {
    this.headerlog.debug(getId() + " >> " + request.getRequestLine().toString());
    final Header[] headers = request.getAllHeaders();
    for (final Header header : headers) {
      this.headerlog.debug(getId() + " >> " + header.toString());
    }
  }
}

代码示例来源:origin: org.commonjava.maven.galley/galley-transport-httpclient

public HttpExchangeMetadata( final HttpRequest request, final HttpResponse response )
{
  populateHeaders( requestHeaders, request.getAllHeaders() );
  populateHeaders( responseHeaders, response.getAllHeaders() );
  final StatusLine sl = response.getStatusLine();
  this.responseStatusCode = sl.getStatusCode();
  this.responseStatusMessage = sl.getReasonPhrase();
}

代码示例来源:origin: zalando/logbook

@Override
public Map<String, List<String>> getHeaders() {
  final HeadersBuilder builder = new HeadersBuilder();
  for (final Header header : request.getAllHeaders()) {
    builder.put(header.getName(), header.getValue());
  }
  return builder.build();
}

代码示例来源:origin: MobiVM/robovm

public void resetHeaders() {
  // Make a copy of original headers
  this.headergroup.clear();
  setHeaders(this.original.getAllHeaders());
}

代码示例来源:origin: com.intuit.karate/karate-apache

public static void logHeaders(StringBuilder sb, int id, char prefix, org.apache.http.HttpRequest request, HttpRequest actual) {
  for (String key : sortKeys(request.getAllHeaders())) {
    Header[] headers = request.getHeaders(key);
    logHeaderLine(sb, id, prefix, key, headers);
    for (Header header : headers) {
      actual.addHeader(header.getName(), header.getValue());
    }
  }
}

相关文章