嗨,我正在从服务器下载文件。我必须使用 HEAD 方法获取元信息。andybody 帮助我实现 HEAD 方法以获取“最后修改”日期和修改后的日期。
这是我的代码:
HttpClient client= new DefaultHttpClient();
//HttpGet get = new HttpGet(url);
HttpHead method = new HttpHead(url);
HttpResponse response= client.execute(method);
Header[] s=response.getAllHeaders();
System.out.println("THe header from the httpclient:");
for(int i=0; i < s.length; i++){
Header hd = s[i];
System.out.println("Header Name: "+hd.getName()
+ " " + " Header Value: " + hd.getValue());
}
//here I have to implement the HEAD method