我目前正在尝试理解下面每个代码背后的逻辑。请告诉我我是否正确并回答我的困惑。
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
然后阅读:
关于java - HttpURLConnection、openConnection 和 setRequestMethod ("GET",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27584751/