Header 字段里没有location 吗
HttpClient http = new HttpClient();
GetMethod get = new GetMethod("http://127.0.0.1/soft/download.asp?softid=25063&downid=3&id=25730");
int s = http.executeMethod(get);
System.out.println(s);
/*Header locationHeader = get.getResponseHeader("location");
if(locationHeader!=null){
String location = locationHeader.getValue();
System.out.println("The page was redirected to:" + location);
}*/
Header[] head = get.getResponseHeaders();
for(int i=0;i<head.length;i++){
System.out.println(head[i].toString());
} String str = "";
str = new String(get.getResponseBodyAsString().getBytes("ISO-8859-1"),"GBK");
// System.out.println(str);
get.releaseConnection(); 输出的结果是 200
Content-Length: 45056 Content-Type: application/octet-stream Last-Modified: Wed, 10 Oct 2007 10:21:17 GMT Accept-Ranges: bytes ETag: "65b704b27bc81:13d3" Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET Date: Tue, 11 Mar 2008 06:03:17 GMT 怎么看不到 location 信息啊
HttpClient http = new HttpClient();
GetMethod get = new GetMethod("http://127.0.0.1/soft/download.asp?softid=25063&downid=3&id=25730");
int s = http.executeMethod(get);
System.out.println(s);
/*Header locationHeader = get.getResponseHeader("location");
if(locationHeader!=null){
String location = locationHeader.getValue();
System.out.println("The page was redirected to:" + location);
}*/
Header[] head = get.getResponseHeaders();
for(int i=0;i<head.length;i++){
System.out.println(head[i].toString());
} String str = "";
str = new String(get.getResponseBodyAsString().getBytes("ISO-8859-1"),"GBK");
// System.out.println(str);
get.releaseConnection(); 输出的结果是 200
Content-Length: 45056 Content-Type: application/octet-stream Last-Modified: Wed, 10 Oct 2007 10:21:17 GMT Accept-Ranges: bytes ETag: "65b704b27bc81:13d3" Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET Date: Tue, 11 Mar 2008 06:03:17 GMT 怎么看不到 location 信息啊
解决方案 »
- LinkedList类型中的元素是不是不能为Set这些Collection类的子类
- 自学java路上的一些疑惑
- 如何使用jsr-80
- 大家好,本人辞去GUI版主职务,感谢大家的支持
- 一个很基本的字符串定义问题,请大家解答一下
- 小妹初学Java!各位师哥给介绍几本好书啊!
- 请教高手!这段程序中到底出了什么问题????
- 下载Java2 API文档的URL?
- %%%%%%%%%%%%%%%%%%%%有人用过joc这种混淆器的吗?我用it混淆了我的Applet,在IE下报告:找不到主类。用javac编译就可以。是怎么回事??
- 我实在是在太弱拉!!
- 怎样运用Java中的Calendar类来把半年的时间计算成毫秒!非常感谢!
- overriding VS overloading
你访问了一个没有转向的页面,或者HttpClient设置了自动转向?