如何执行 HTTP 删除?我所得到的只是网址
我只是 java 的初学者,想知道如何对 URL 进行 HTTP 删除调用。 任何一小段代码或参考资料都会非常有帮助。
我知道这个问题听起来很简单,但我急需这些信息。
I'm just a starter in java and would like to know how to make a HTTP Delete call to a URL.
Any small piece of code or reference material would be very helpful.
I know that the question would sound very simply, but I am in urgent of this information.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
DELETE、PUT、OPTIONS 方法受到大多数服务器的限制。这是关于这个话题的很好的讨论。
PUT、DELETE、HEAD、大多数网络浏览器都提供等方法?
DELETE, PUT, OPTIONS methods are restricted by most of the servers. Here is good discussion about this topic in SO.
Are the PUT, DELETE, HEAD, etc methods available in most web browsers?
实际上发送 HttpDelete 与 HttpGet 类似,首先您将构建带有所有参数的 url,然后执行请求,以下代码经过测试。
Actually sending HttpDelete is similar to HttpGet, first you will build the url with all parameters and then just execute the request, the following code is tested.
您可以使用 Restlet。它是一个很好的客户端API。或者你可以执行以下操作
You can use Restlet. Its a good client API.Or you can do as following
我想你可以这样打电话:
I guess you can call like this :
您还可以尝试 Apache HttpClient,它为所有 HTTP 方法(GET、PUT、DELETE、POST、OPTIONS、HEAD 和 TRACE)提供 API。
有关示例,请参见此处: http://hc.apache.org/httpclient-3 .x/methods/delete。
API参考在这里:http://hc.apache.org/httpclient- 3.x/apidocs/index.html
干杯
You can also try the Apache HttpClient, it provides an API for all HTTP methods (GET, PUT, DELETE, POST, OPTIONS, HEAD, and TRACE).
For a sample look here: http://hc.apache.org/httpclient-3.x/methods/delete.
API reference is here: http://hc.apache.org/httpclient-3.x/apidocs/index.html
Cheers