我正在编写一个 Java 应用程序,并将我的 CSV 文件(2000 条记录)
作为请求正文发送。我遇到了两个不同类的两种方法。 setEntity(HttpPost Class)
和 setRequestEntity(PostMethod Class)
。有人能解释一下它的工作原理吗?哪种方式发送请求体比较好?
最佳答案
答案很简单。
Commons HttpClient(旧版)
Commons HttpClient 3.x 代码线已结束(使用 postMethod.setRequestEntity(requestEntity);
)。
强烈建议 Commons HttpClient 3.x 的所有用户升级到 HttpClient 4.1 (postMethod.setEntity(requestEntity);
)。
引用:
关于java - setEntityMethod 和 SetRequestEntityMethod 之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47265821/