简体   繁体   English

监视Java应用程序的流量

[英]Monitor traffic of Java Application

I have a console Java application. 我有一个控制台Java应用程序。 Some of HTTP requests return error codes, and I want to debug them. 一些HTTP请求返回错误代码,我想调试它们。 In browser I can watch POST requests in detail, but how can I manage to do it in Java application? 在浏览器中,我可以详细查看POST请求,但是如何在Java应用程序中做到这一点呢?

In your getHttpRequest (or whatever it is called) method print incoming request. 在您的getHttpRequest(或任何它称为)方法中,打印传入请求。 That would be the simplest solution. 那将是最简单的解决方案。

More sophisticated - you can extend standard classes which work with requests and modify methods which get requests to print them first. 更复杂-您可以扩展用于请求的标准类,并修改获取请求以首先打印请求的方法。

Try Wireshark or fiddler. 尝试使用Wireshark或Fiddler。 The both sniff traffic in a similar manner as firefox and various browsers do now. 两者都以类似于Firefox和各种浏览器的方式嗅探流量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM