这个问题在这里已经有了答案:关闭10年前。PossibleDuplicate:JavaHttpURLConnection例如,如果我想从我连接的服务器读取对POST方法调用的响应,是否会使用此方法?
我正在使用以下代码行调用POST网络服务。我不清楚connection.setDoOutput(true);和connection.setDoInput(true);能否详细说明这段代码的用途?我能否将相同的代码与GET一起使用?URLurl=newURL("http://xxxxxx.com");HttpURLConnectionconnection=(HttpURLConnection)url.openConnection();connection.setRequestMethod("POST");connection.setDoOutput(true);connection.se
HttpURLConnection.setDoInput和HttpURLConnection.setDoOutput的作用或目的是什么? 最佳答案 来自URLConnection的文档:SettheDoInputflagtotrueifyouintendtousetheURLconnectionforinput,falseifnot.Thedefaultistrue.SettheDoOutputflagtotrueifyouintendtousetheURLconnectionforoutput,falseifnot.Thedefa
HttpURLConnection.setDoInput和HttpURLConnection.setDoOutput的作用或目的是什么? 最佳答案 来自URLConnection的文档:SettheDoInputflagtotrueifyouintendtousetheURLconnectionforinput,falseifnot.Thedefaultistrue.SettheDoOutputflagtotrueifyouintendtousetheURLconnectionforoutput,falseifnot.Thedefa