gpt4 book ai didi

java - HttpURLConnection、openConnection 和 setRequestMethod ("GET"

转载 作者:行者123 更新时间:2023-12-01 12:06:06 24 4
gpt4 key购买 nike

我目前正在尝试理解下面每个代码背后的逻辑。请告诉我我是否正确并回答我的困惑。

urlConnection = (HttpURLConnection) url.openConnection(); 
//connection object is created. However, do not understand
//"manipulate parameters that affect the connection to the remote resource."
urlConnection.setRequestMethod("GET");
//set the method for the URL request. Not sure what that means!
//there are other strings that could be used, but not sure what each means,
//and couldn't the Java documentations didn't seem to have explanations either
urlConnection.connect();
//the actual connection the the remote object is made

最佳答案

这个问题与Java完全无关。你需要的是了解HTTP协议(protocol)并做一些全面的阅读。我建议从

开始

http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol

然后阅读:

https://www.rfc-editor.org/rfc/rfc7230

关于java - HttpURLConnection、openConnection 和 setRequestMethod ("GET",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27584751/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com