本地主机网络监控和httpservlet请求

发布于 2024-08-09 07:09:00 字数 183 浏览 4 评论 0原文

我的机器上有两台相互通信的 Tomcat 服务器。

1)有人可以推荐一个好的(免费)网络嗅探器,以便我能够监视它们之间发送的请求/响应吗?

2)如何在java代码中检查请求?查看 header 和 body 的组成及其结构?

多谢, 由于某种原因,#2 并不像我想象的那么简单。

I have two Tomcat servers on my machine that communicate with one another.

1) Can someone recommend on a good (free) network sniffer so I'll be able to monitor the requests/ response that being sent between them?

2) How can I inspect the request in java code? to see what the header and the body consists and their structures?

thanks a lot,
from some reason #2 is not as straight forward as i thought it would be.

Me

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

堇色安年 2024-08-16 07:09:01

我刚刚使用

http://socketsniff.nirsoft-freeware.qarchive.org/_download2.html

它完美地满足了我的需求。

无耻地从这个问题复制:

Sniffer for localhost (Windows OS)

I just used

http://socketsniff.nirsoft-freeware.qarchive.org/_download2.html

and it worked flawlessly for what I wanted.

Shamelessly copied from this question:

Sniffer for localhost (Windows OS)

囍孤女 2024-08-16 07:09:00

1) Wireshark 是“最”的网络嗅探器。但是如果您在 Windows 上并且想要一种快速、简单的方法来查看 http 流量,请查看 Fiddler。它是一个 IE 插件,但可以监视来自您计算机的所有 http 流量。

2) 在 servlet 或更好的 servlet 过滤器中添加以下内容。

Enumeration headerNames = request.getHeaderNames();
    while(headerNames.hasMoreElements()) {
      String headerName = (String)headerNames.nextElement();
      out.println("<TR><TD>" + headerName);
      out.println("    <TD>" + request.getHeader(headerName));
    }

1) Wireshark is "the" network sniffer.But if your on windows and want a quick and easy way to see http traffic have a look at Fiddler.Its an IE plugin but can monitor all http traffic from your machine.

2) In the servlet or better yet the servlet filter add the following.

Enumeration headerNames = request.getHeaderNames();
    while(headerNames.hasMoreElements()) {
      String headerName = (String)headerNames.nextElement();
      out.println("<TR><TD>" + headerName);
      out.println("    <TD>" + request.getHeader(headerName));
    }
清君侧 2024-08-16 07:09:00

我喜欢 Wireshark

如果您使用的是 Windows,则无法直接监视 127.0.0.1 环回。您将需要设置一个备用环回适配器(在另一个地址上具有相同的功能)。 Wireshark 文档对此进行了详细介绍:

http://wiki.wireshark.org/CaptureSetup/Loopback

我不确定你的第二个问题是什么意思,你能说得更详细吗?

如果您的所有请求都是基于 HTTP 的,那么 Wireshark 将能够显示标头和正文数据,但它位于 Java 代码的上下文之外。

I like Wireshark.

If you're on Windows, you can't directly monitor the 127.0.0.1 loopback. You will need to set up an alternate loopback adapter (the same functionality on another address). This is detailed in the Wireshark docs:

http://wiki.wireshark.org/CaptureSetup/Loopback

I'm not sure what you mean by your second question, can you go into more detail?

If all your requests are HTTP-based, then Wireshark will be able to show the headers and body data, but it's outside the context of the Java code.

痴梦一场 2024-08-16 07:09:00

为 2 号设备设置 Tomcat 服务器进行远程调试怎么样?添加断点以便您可以检查对象? http://wiki.apache.org/tomcat/FAQ/Developing

How about setting up the Tomcat servers for remote debugging for number 2? Add a break point so you can inspect the objects? http://wiki.apache.org/tomcat/FAQ/Developing

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文