org.apache.http.client.methods.CloseableHttpResponse.getLastHeader()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(4.5k)|赞(0)|评价(0)|浏览(180)

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

CloseableHttpResponse.getLastHeader介绍

暂无

代码示例

代码示例来源:origin: medcl/elasticsearch-analysis-ik

if (((response.getLastHeader("Last-Modified")!=null) && !response.getLastHeader("Last-Modified").getValue().equalsIgnoreCase(last_modified))
    ||((response.getLastHeader("ETag")!=null) && !response.getLastHeader("ETag").getValue().equalsIgnoreCase(eTags))) {
  last_modified = response.getLastHeader("Last-Modified")==null?null:response.getLastHeader("Last-Modified").getValue();
  eTags = response.getLastHeader("ETag")==null?null:response.getLastHeader("ETag").getValue();

代码示例来源:origin: apache/geode

private String getCookieHeader(CloseableHttpResponse resp) {
 Header lastHeader = resp.getLastHeader("Set-Cookie");
 if (lastHeader == null) {
  return null;
 }
 return lastHeader.getElements()[0].getValue();
}

代码示例来源:origin: yasserg/crawler4j

long size = fetchResult.getEntity().getContentLength();
if (size == -1) {
  Header length = response.getLastHeader(HttpHeaders.CONTENT_LENGTH);
  if (length == null) {
    length = response.getLastHeader("Content-length");

代码示例来源:origin: org.apache.sling/org.apache.sling.testing.clients

@Override
public Header getLastHeader(String name) {
  return httpResponse.getLastHeader(name);
}

代码示例来源:origin: com.googlecode.openbox/http

public Header getLastHeader(String name) {
  return httpResponse.getLastHeader(name);
}

代码示例来源:origin: KennFalcon/elasticsearch-analysis-hanlp

/**
 * 加载远程自定义词典
 *
 * @param response header响应
 */
private void loadRemoteCustomWords(CloseableHttpResponse response) {
  switch (type) {
    case "custom":
      logger.info("load hanlp remote custom dict path: {}", location);
      loadRemoteWordsUnprivileged(location);
      logger.info("finish load hanlp remote custom dict path: {}", location);
      break;
    case "stop":
      logger.info("load hanlp remote stop words path: {}", location);
      loadRemoteStopWordsUnprivileged(location);
      logger.info("finish load hanlp remote stop words path: {}", location);
      break;
    default:
      return;
  }
  last_modified = response.getLastHeader("Last-Modified") == null ? null : response.getLastHeader("Last-Modified").getValue();
  eTags = response.getLastHeader("ETag") == null ? null : response.getLastHeader("ETag").getValue();
}

代码示例来源:origin: bells/elasticsearch-analysis-dynamic-synonym

response = executeHttpRequest(head);
if (response.getStatusLine().getStatusCode() == 200) { // 返回200 才做操作
  if (!response.getLastHeader(LAST_MODIFIED_HEADER).getValue()
      .equalsIgnoreCase(lastModified)
      || !response.getLastHeader(ETAG_HEADER).getValue()
      .equalsIgnoreCase(eTags)) {
    lastModified = response.getLastHeader(LAST_MODIFIED_HEADER) == null ? null
        : response.getLastHeader(LAST_MODIFIED_HEADER)
        .getValue();
    eTags = response.getLastHeader(ETAG_HEADER) == null ? null
        : response.getLastHeader(ETAG_HEADER).getValue();
    return true;

代码示例来源:origin: KennFalcon/elasticsearch-analysis-hanlp

response = httpclient.execute(head);
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
  if ((response.getLastHeader("Last-Modified") != null) && !response.getLastHeader("Last-Modified").getValue().equalsIgnoreCase(last_modified)) {
    loadRemoteCustomWords(response);
  } else if ((response.getLastHeader("ETag") != null) && !response.getLastHeader("ETag").getValue().equalsIgnoreCase(eTags)) {
    loadRemoteCustomWords(response);

代码示例来源:origin: edu.uci.ics/crawler4j

long size = fetchResult.getEntity().getContentLength();
if (size == -1) {
  Header length = response.getLastHeader("Content-Length");
  if (length == null) {
    length = response.getLastHeader("Content-length");

代码示例来源:origin: org.apache.jmeter/ApacheJMeter_http

Header contentType = httpResponse.getLastHeader(HTTPConstants.HEADER_CONTENT_TYPE);
if (contentType != null){
  String ct = contentType.getValue();
res.setResponseHeaders(getResponseHeaders(httpResponse));
if (res.isRedirect()) {
  final Header headerLocation = httpResponse.getLastHeader(HTTPConstants.HEADER_LOCATION);
  if (headerLocation == null) { // HTTP protocol violation, but avoids NPE
    throw new IllegalArgumentException("Missing location header in redirect for " + httpRequest.getRequestLine());

代码示例来源:origin: org.esigate/esigate-core

response.removeHeader(response.getLastHeader("Cache-control"));

相关文章