我试图使用http单元读取应用程序的响应标头-
WebClient webClient = new WebClient();
WebClient.setThrowExceptionOnScriptError(false);
HtmlPage currentPage = webClient.getPage("http://myapp.com");
WebResponse response = currentPage.getWebResponse();
System.out.println(response.getResponseHeaders());
我确实看到了响应头,但它们仅限于第一个http get请求。当我将LiveHTTPHeaders插件用于firefox插件时,我得到了所有的get请求和相应的标头响应。
有什么方法可以获取所有后续请求的http标头,而不仅限于第一个获取?
List<NameValuePair> response =currentPage.getWebResponse().getResponseHeaders();
for (NameValuePair header : response) {
System.out.println(header.getName() + " = " + header.getValue());
}
对我来说很好。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句