如何使用 java.net. urlconnection 触发和处理 HTTP 请求

Use of java.net.URLConnection is asked about pretty often here, and the Oracle tutorial is too concise about it.

That tutorial basically only shows how to fire a GET request and read the response. It doesn't explain anywhere how to use it to among others perform a POST request, set request headers, read response headers, deal with cookies, submit a HTML form, upload a file, etc.

So, how can I use java.net.URLConnection to fire and handle "advanced" HTTP requests?

转载于:https://stackoverflow.com/questions/2793150/how-to-use-java-net-urlconnection-to-fire-and-handle-http-requests

查看全部
csdnceshi59
ℙℕℤℝ
2010/05/08 06:16
  • urlconnection
  • java
  • httprequest
  • http
  • httpurlconnection
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

11个回复