相当于 Java 中 .NET 的 WebClient 和 HttpWebRequest?
.NET 有 HttpWebRequest 和 WebClient 用于模拟浏览器请求的类。
我会用谷歌搜索,但我不知道该使用什么关键字。
我想编写在小程序或本地 .jar
中执行 HTTP GET 和 POST 以及 cookie 的代码,并以文本字符串或其他可解析结构的形式返回响应。
.NET has the HttpWebRequest and WebClient classes for simulating a browser's requests.
I'd google it, but I'm not sure what keyword to use.
I want to write code that does does HTTP GETs and POSTs, along with cookies, in an applet or local .jar
and gives me back the response in a text string or some other parseable structure.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
HttpURLConnection
< /a> 相当于 Java 中的HttpWebRequest
。HttpURLConnection
is Java's equivalent ofHttpWebRequest
.Apache HTTPClient 具有相同的功能,但 API 并不完全相同。 Oakland Software 有一个表格将其商业产品与各种替代品(包括 Apache 产品)进行比较。 Apache 对内置 HttpUrlConnection 的看法(引用自上面的链接页面)是:
以下是 HTTPClient 教程 的链接。
Apache HTTPClient has equivalent functionality, though the APIs are not exactly the same. Oakland Software has a table comparing their commercial product with various alternatives, including the Apache product. Apache's own opinion of the built-in HttpUrlConnection (quoted from the above linked-to page) is:
Here's a link to the HTTPClient tutorial.
html 单元对我来说。
我可以模拟javascript(在一定程度上)
html unit for me.
i can simulate javascript (to a certain extent)
验证 Apache Cx JaxRs 库中的 Webclient。
结帐这个:
https://cxf.apache.org/javadoc /latest/org/apache/cxf/jaxrs/client/WebClient.html
示例代码如下:
Verify Webclient in Apache Cx JaxRs Library.
Checkout this:
https://cxf.apache.org/javadoc/latest/org/apache/cxf/jaxrs/client/WebClient.html
Sample code looks below: