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 信息啊
你访问了一个没有转向的页面,或者HttpClient设置了自动转向?