java - 使用 Java 将 HTTP post 发送到 Web 服务器

标签 java http networking

根据标题,我真的想发送一个自定义的 HTTP post向网络服务器请求,我在这方面经验很少。 Web 服务器使用 LDAP用于访问控制的服务器(不确定这是否重要),我当然知道用户名和密码。有人可以充实一些代码来做到这一点,或者至少让我开始吗?

编辑其中一条评论,服务器正在运行包含 PhP 5+ 和 Apache 2+ 的 LAMP 堆栈

最佳答案

您可以使用HttpClient来自 Apache 的模块。

Although the java.net package provides basic functionality for accessing resources via HTTP, it doesn't provide the full flexibility or functionality needed by many applications. HttpClient seeks to fill this void by providing an efficient, up-to-date, and feature-rich package implementing the client side of the most recent HTTP standards and recommendations.

Designed for extension while providing robust support for the base HTTP protocol, HttpClient may be of interest to anyone building HTTP-aware client applications such as web browsers, web service clients, or systems that leverage or extend the HTTP protocol for distributed communication.

关于java - 使用 Java 将 HTTP post 发送到 Web 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2305849/

相关文章:

http - 什么决定下载的文件应该保存为只读还是读写?

聊天服务器和客户端实现?

networking - 跨子网的UDP广播数据包

Java ExecutorService - 监控任务完成/状态栏

java - 从数据库获取值到 JLabel

java - Hibernate 查询语言(如运算符)不起作用

android - 我们使用哪个包来建立 HTTP 连接?

http - 如何在 POST 请求中模拟 HTML 表单提交?

java - 尝试使用 gradle 发布到 JCenter 时,没有方法签名适用于参数类型

linux - 如何在 Linux 上以编程方式获取网络接口(interface)速度?