我的代码是这样的:在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