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

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

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

HttpRequest.getProtocolVersion介绍

暂无

代码示例

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

public RequestWrapper(final HttpRequest request) throws ProtocolException {
  super();
  if (request == null) {
    throw new IllegalArgumentException("HTTP request may not be null");
  }
  this.original = request;
  setParams(request.getParams());
  // Make a copy of the original URI 
  if (request instanceof HttpUriRequest) {
    this.uri = ((HttpUriRequest) request).getURI();
    this.method = ((HttpUriRequest) request).getMethod();
    this.version = null;
  } else {
    RequestLine requestLine = request.getRequestLine();
    try {
      this.uri = new URI(requestLine.getUri());
    } catch (URISyntaxException ex) {
      throw new ProtocolException("Invalid request URI: " 
          + requestLine.getUri(), ex);
    }
    this.method = requestLine.getMethod();
    this.version = request.getProtocolVersion();
  }
  this.execCount = 0;
}

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

@Override
public ProtocolVersion getProtocolVersion()
{
  return implementation.getProtocolVersion();
}

代码示例来源:origin: com.hynnet/httpclient

@Override
public ProtocolVersion getProtocolVersion() {
  return this.version != null ? this.version : this.original.getProtocolVersion();
}

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

@Override
public ProtocolVersion getProtocolVersion() {
  return this.version != null ? this.version : this.original.getProtocolVersion();
}

代码示例来源:origin: kingthy/TVRemoteIME

int requestHttpMinorVersion = httpRequest.getProtocolVersion().getMinor();
requestMessage.getOperation().setHttpMinorVersion(requestHttpMinorVersion);

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

@Override
public ProtocolVersion getProtocolVersion() {
  return this.version != null ? this.version : this.original.getProtocolVersion();
}

代码示例来源:origin: Nextdoor/bender

@Override
public ProtocolVersion getProtocolVersion() {
  return this.version != null ? this.version : this.original.getProtocolVersion();
}

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

@Override
public ProtocolVersion getProtocolVersion() {
  return this.version != null ? this.version : this.original.getProtocolVersion();
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.apache.httpcomponents.httpclient

public ProtocolVersion getProtocolVersion() {
  return this.version != null ? this.version : this.original.getProtocolVersion();
}

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

public ProtocolVersion getProtocolVersion() {
  return this.version != null ? this.version : this.original.getProtocolVersion();
}

代码示例来源:origin: org.apache.httpcomponents/com.springsource.org.apache.httpcomponents.httpclient-cache

protected boolean requestVersionIsTooLow(HttpRequest request) {
  return request.getProtocolVersion().compareToVersion(HttpVersion.HTTP_1_1) < 0;
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.apache.httpcomponents.httpclient

private boolean requestProtocolGreaterThanAccepted(final HttpRequest req) {
  return req.getProtocolVersion().compareToVersion(HttpVersion.HTTP_1_1) > 0;
}

代码示例来源:origin: org.apache.httpcomponents/com.springsource.org.apache.httpcomponents.httpclient-cache

private ProtocolVersion getOriginalRequestProtocol(RequestWrapper request) {
  return request.getOriginal().getProtocolVersion();
}

代码示例来源:origin: org.apache.httpcomponents/com.springsource.org.apache.httpcomponents.httpclient-cache

private boolean requestProtocolGreaterThanAccepted(HttpRequest req) {
  return req.getProtocolVersion().compareToVersion(HttpVersion.HTTP_1_1) > 0;
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.apache.httpcomponents.httpclient

protected boolean requestVersionIsTooLow(final HttpRequest request) {
  return request.getProtocolVersion().compareToVersion(HttpVersion.HTTP_1_1) < 0;
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.apache.httpcomponents.httpclient

private void transferEncodingIsNotReturnedTo1_0Client(final HttpRequestWrapper request,
    final HttpResponse response) {
  final HttpRequest originalRequest = request.getOriginal();
  if (originalRequest.getProtocolVersion().compareToVersion(HttpVersion.HTTP_1_1) >= 0) {
    return;
  }
  removeResponseTransferEncoding(response);
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.apache.httpcomponents.httpclient

protected boolean requestMinorVersionIsTooHighMajorVersionsMatch(final HttpRequest request) {
  final ProtocolVersion requestProtocol = request.getProtocolVersion();
  if (requestProtocol.getMajor() != HttpVersion.HTTP_1_1.getMajor()) {
    return false;
  }
  if (requestProtocol.getMinor() > HttpVersion.HTTP_1_1.getMinor()) {
    return true;
  }
  return false;
}

代码示例来源:origin: org.apache.httpcomponents/com.springsource.org.apache.httpcomponents.httpclient-cache

protected boolean requestMinorVersionIsTooHighMajorVersionsMatch(HttpRequest request) {
  ProtocolVersion requestProtocol = request.getProtocolVersion();
  if (requestProtocol.getMajor() != HttpVersion.HTTP_1_1.getMajor()) {
    return false;
  }
  if (requestProtocol.getMinor() > HttpVersion.HTTP_1_1.getMinor()) {
    return true;
  }
  return false;
}

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

private Task preProcess(HttpRequest request) {
  final RequestLine rl = request.getRequestLine();
  final String taskName = String.format("%S %s %S", rl.getMethod(), rl.getUri(), request.getProtocolVersion());
  final Task task = taskManagerService.createSubTask(taskName, TASK_GROUP_CLIENT);
  task.updateMessage("preparing request");
  task.updateDetailMessage("method", rl.getMethod());
  task.updateDetailMessage("url", rl.getUri());
  // TODO: some more detail messages?
  if (request instanceof HttpEntityEnclosingRequest) {
    // To report upload progress, the entity is wrapped in a MonitoredHttpEntity.
    final HttpEntityEnclosingRequest entityRequest = (HttpEntityEnclosingRequest) request;
    entityRequest.setEntity(new MonitoredHttpEntity(entityRequest.getEntity(), task, bytesSent));
  }
  task.updateMessage("sending request");
  return task;
}

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

private Task preProcess(HttpRequest request) {
  final RequestLine rl = request.getRequestLine();
  final String taskName = String.format("%S %s %S", rl.getMethod(), rl.getUri(), request.getProtocolVersion());
  final Task task = taskManagerService.createSubTask(taskName, TASK_GROUP_CLIENT);
  task.updateMessage("preparing request");
  task.updateDetailMessage("method", rl.getMethod());
  task.updateDetailMessage("url", rl.getUri());
  // TODO: some more detail messages?
  if (request instanceof HttpEntityEnclosingRequest) {
    // To report upload progress, the entity is wrapped in a MonitoredHttpEntity.
    final HttpEntityEnclosingRequest entityRequest = (HttpEntityEnclosingRequest) request;
    entityRequest.setEntity(new MonitoredHttpEntity(entityRequest.getEntity(), task, bytesSent));
  }
  task.updateMessage("sending request");
  return task;
}

相关文章