我的代碼是這樣的:在URLConnection中設置標題的正確方法是什麼?
URLConnection cnx = address.openConnection();
cnx.setAllowUserInteraction(false);
cnx.setDoOutput(true);
cnx.addRequestProperty("User-Agent",
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)");
InputStream is = cnx.getInputStream();
是否確定,如果我設置的標頭之前,我的InputStream
?我的頭文件會被髮送,還是服務器會看到默認URLConnection
的用戶代理(如果有的話)?
此鏈接已損壞。 – Fabii 2012-04-03 14:32:15