【发布时间】:2008-12-01 17:21:51
【问题描述】:
我的代码如下:
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 的用户代理(如果有)?
【问题讨论】:
标签: java header urlconnection