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

x33g5p2x  于2022-01-20 转载在 其他  
字(2.9k)|赞(0)|评价(0)|浏览(221)

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

HttpRequest.setVersion介绍

暂无

代码示例

代码示例来源:origin: apache/httpcomponents-client

/**
 * If the {@link HttpRequest} is non-compliant but 'fixable' we go ahead and
 * fix the request here.
 *
 * @param request the request to check for compliance
 */
public void makeRequestCompliant(final HttpRequest request) {
  decrementOPTIONSMaxForwardsIfGreaterThen0(request);
  stripOtherFreshnessDirectivesWithNoCache(request);
  if (requestVersionIsTooLow(request) || requestMinorVersionIsTooHighMajorVersionsMatch(request)) {
    request.setVersion(HttpVersion.HTTP_1_1);
  }
}

代码示例来源:origin: apache/httpcomponents-client

@Test
public void upgrades1_0RequestTo1_1() throws Exception {
  final HttpRequest req = new BasicHttpRequest("GET", "/");
  req.setVersion(HttpVersion.HTTP_1_0);
  final HttpRequest wrapper = RequestCopier.INSTANCE.copy(req);
  impl.makeRequestCompliant(wrapper);
  assertEquals(HttpVersion.HTTP_1_1, wrapper.getVersion());
}

代码示例来源:origin: apache/httpcomponents-client

@Test
public void downgrades1_2RequestTo1_1() throws Exception {
  final HttpRequest req = new BasicHttpRequest("GET", "/");
  req.setVersion(new ProtocolVersion("HTTP", 1, 2));
  final HttpRequest wrapper = RequestCopier.INSTANCE.copy(req);
  impl.makeRequestCompliant(wrapper);
  assertEquals(HttpVersion.HTTP_1_1, wrapper.getVersion());
}

代码示例来源:origin: org.apache.httpcomponents.client5/httpclient5-cache

/**
 * If the {@link HttpRequest} is non-compliant but 'fixable' we go ahead and
 * fix the request here.
 *
 * @param request the request to check for compliance
 */
public void makeRequestCompliant(final HttpRequest request) {
  decrementOPTIONSMaxForwardsIfGreaterThen0(request);
  stripOtherFreshnessDirectivesWithNoCache(request);
  if (requestVersionIsTooLow(request) || requestMinorVersionIsTooHighMajorVersionsMatch(request)) {
    request.setVersion(HttpVersion.HTTP_1_1);
  }
}

代码示例来源:origin: org.apache.httpcomponents.core5/httpcore5

@Override
protected T createMessage(final CharArrayBuffer buffer) throws HttpException {
  final RequestLine requestLine = getLineParser().parseRequestLine(buffer);
  final T request = this.requestFactory.newHttpRequest(requestLine.getMethod(), requestLine.getUri());
  request.setVersion(requestLine.getProtocolVersion());
  return request;
}

代码示例来源:origin: apache/httpcomponents-core

@Override
protected T createMessage(final CharArrayBuffer buffer) throws HttpException {
  final RequestLine requestLine = getLineParser().parseRequestLine(buffer);
  final T request = this.requestFactory.newHttpRequest(requestLine.getMethod(), requestLine.getUri());
  request.setVersion(requestLine.getProtocolVersion());
  return request;
}

代码示例来源:origin: apache/httpcomponents-core

httpRequest.setVersion(HttpVersion.HTTP_2);
httpRequest.setScheme(scheme);
try {

代码示例来源:origin: org.apache.httpcomponents.client5/httpclient5

connect.setVersion(HttpVersion.HTTP_1_1);

相关文章