我正在尝试调试检查其标头的小型HTTP客户端。我很难检查HTTP的头部,有没有什么eclipse插件可以用来监控HTTP客户端(HTTP头部)?
发布于 2012-12-17 15:17:26
试试blow链接。eclipse中有一个工具,名为TCP/IP monitor.It提供了一个控制台。所有你需要添加的就是你的服务器端口,让我们假设localhost:8080和一个监控端口8081 (根据参考)
然后,当您在http://localhost:8081/your_servlet_or_page/...上调用时,该调用将重定向到http://localhost:8080/your_servlet_or_page/...,并且您将能够在控制台TCP/IP monitor console中看到标头
参考文献# http://www.avajava.com/tutorials/lessons/how-do-i-monitor-http-communication-in-eclipse.html http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.wst.wsi.ui.doc.user%2Ftasks%2Ftmonitor.html
上面的参考资料已经过me..it的测试,运行良好。
发布于 2012-12-17 14:51:58
检查这是否有帮助
public class GetHttpHeaders {
public static void main(String[] args) throws IOException {
try {
URL url = new URL("http://localhost:8080");
URLConnection conn = url.openConnection();
for (int i = 0;; i++) {
String name = conn.getHeaderFieldKey(i);
String value = conn.getHeaderField(i);
if (name == null && value == null) {
break;
}
if (name == null) {
System.out
.println("Server HTTP version, Response code:");
System.out.println(value);
System.out.print("\n");
} else {
System.out.println(name + "=" + value);
}
}
} catch (Exception e) {
}
}
}https://stackoverflow.com/questions/13909145
复制相似问题