Java: Display request of an HttpURLConnection before sending

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-29 01:12:55

You can put the HttpURLConnection in debug mode by enabling java.logging with

-Djava.util.logging.config.file=logging.properties

and put in logging.properties (by default in JRE_HOME\lib) the following property

sun.net.www.protocol.http.HttpURLConnection.level = ALL

tcpdump will work, but it can be hard to make it do what you want. NetCat is more user-friendly (here's the project page: http://netcat.sourceforge.net/ - most Unix platforms already include it).

nc -l 9999

This will listen on TCP port 9999, and when an HTTP client connects, it'll print out the full text of the request.

Use something like tcpdump, which can dump the actual network packets that are emitted or received by your computer.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!