简体   繁体   English

如何使用 Apache HttpComponents Client 请求 CONNECT

[英]How request CONNECT with Apache HttpComponents Client

Apache says:阿帕奇 说:

"HttpComponents Client is a successor of and replacement for Commons HttpClient 3.x. Users of Commons HttpClient are strongly encouraged to upgrade." “HttpComponents Client 是 Commons HttpClient 3.x 的继承者和替代品。强烈建议 Commons HttpClient 的用户升级。”

In package org.apache.http.client.methods almost all Http methods are supported:org.apache.http.client.methods包中,几乎支持所有 Http 方法:

  • OPTIONS (HttpOptions)选项(HttpOptions)
  • GET (HttpGet)获取(HttpGet)
  • HEAD (HttpHead)头 (HttpHead)
  • PATCH (HttpPatch)补丁(HttpPatch)
  • POST (HttpPost) POST (HttpPost)
  • PUT (HttpPut) PUT (HttpPut)
  • DELETE (HttpDelete)删除 (HttpDelete)
  • TRACE (HttpTrace)跟踪 (HttpTrace)

But what is with the method CONNECT?但是 CONNECT 方法是什么? How to execute a CONNECT request?如何执行 CONNECT 请求?

("Before" in org.apache.commons.httpclient there exist the ConnectMethod for method CONNECT.) org.apache.commons.httpclient 中的“之前”存在方法 CONNECT 的 ConnectMethod。)

One can easily create a CONNECT request but I am not entirely sure what you intent to do with it可以轻松创建 CONNECT 请求,但我不完全确定您打算用它做什么

HttpRequest connect = new BasicHttpRequest("CONNECT", "somehost:80");

HttpClient creates CONNECT requests internally when establishing an SSL tunnel through a proxy server.当通过代理服务器建立 SSL 隧道时,HttpClient 在内部创建 CONNECT 请求。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Apache HttpComponents。 获取 CONNECT 请求的响应 - Apache HttpComponents. Get response for CONNECT request Apache httpcomponents-client-CloseableHttpResponse方法不起作用 - Apache httpcomponents-client - CloseableHttpResponse methods not working 使用 Apache HttpComponents 客户端签署 AWS HTTP 请求 - Signing AWS HTTP requests with Apache HttpComponents Client 如何在Java中使用Apache HttpComponents发送多部分/表单数据发布请求 - how to sending multipart/form-data Post Request in with use of Apache HttpComponents in java Apache HttpComponents:org.apache.http.client.ClientProtocolException - Apache HttpComponents: org.apache.http.client.ClientProtocolException 如何使用 HttpComponents (Java apache lib) 更改 TLS 握手中的服务器名称指示发出请求 - How to make a request with HttpComponents (Java apache lib) changing Server Name Indication in TLS Handshake 如何将RedirectStrategy添加到Apache HttpComponents NHttpReverseProxy - how to add RedirectStrategy to Apache HttpComponents NHttpReverseProxy 如何在Apache HttpComponents中使用自定义socketfactory - How to use a custom socketfactory in Apache HttpComponents Apache HttpComponents中的第一个请求中不发送代理授权标头 - Proxy-Authorization header is not send within first request in Apache HttpComponents 尽管进行了设置,但Apache HttpComponents并未遵循重定向请求 - Apache HttpComponents does not follow redirect request despite setting
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM