我试图向需要cookie的网页发出请求。我使用HttpURLConnection类,但反应总是回来说Cookie与Java URLConnection关闭
<div class="body"><p>Your browser's cookie functionality is turned off. Please turn it on.
我怎样才能使请求使得查询服务器认为我有饼干打开。我的代码是这样的。
private String readPage(String page) throws MalformedURLException {
try {
URL url = new URL(page);
HttpURLConnection uc = (HttpURLConnection) url.openConnection();
uc.connect();
InputStream in = uc.getInputStream();
int v;
while((v = in.read()) != -1){
sb.append((char)v);
}
in.close();
uc.disconnect();
} catch (IOException e){
e.printStackTrace();
}
return sb.toString();
}
现在我需要弄清楚如何执行http代理身份验证。我曾与URLConnection合作,但现在我需要在这里弄清楚。 tsok,谷歌将prolly找到我的东西;)谢谢! – dharga 2009-09-22 13:01:52