Fiddler没有从Java应用程序捕获HTTP请求 [英] Fiddler not capturing HTTP requests from Java Application

查看:373
本文介绍了Fiddler没有从Java应用程序捕获HTTP请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在编写一个使用HTTP POST将csv文件和一些其他参数上传到服务器的java应用程序。服务器不断向我的应用程序返回500个错误,我想查看Fiddler中的HTTP请求,这样我就能看到POST请求。

当我运行Fiddler时,它不会捕获来自Java应用程序的任何HTTP流量。我写了一个有效的GET请求,所以我知道我可以与服务器通信,但是没有通过Fiddler显示流量。

I am currently writing a java application that uses HTTP POST to upload a csv file and a few other parameters to a server. The server keeps returning 500 errors to my application and I would like to view the HTTP request in Fiddler so I can see the POST request.
When I run Fiddler it will not capture any HTTP traffic from the Java application. I have written a GET request that works, so I know I can communicate with the server, however no traffic is shown through Fiddler.

推荐答案

您可以通过设置属性

http.proxyHost 到<来为您的应用程序设置Fiddler作为HTTP代理em> localhost 和 http.proxyPort 8888 用于HTTP流量,
https.proxyHost / https.proxyPort 用于HTTPS流量。
对于HTTPS流量,您还必须将Fiddler根证书(可在选项对话框中导出)作为可信证书添加到您的应用程序。

http.proxyHost to localhost and http.proxyPort to 8888 for HTTP traffic and https.proxyHost / https.proxyPort for HTTPS traffic. For HTTPS traffic you also have to add the Fiddler root certificate (exportable in options dialog) as trusted certificate to your application.

您可以通过添加代码开头的以下行

You can do so by adding the following lines at the beginning of your code

System.setProperty("http.proxyHost", "localhost");
System.setProperty("http.proxyPort", "8888");

或在启动Java-VM时通过命令行设置它们:

or set them via command line when starting the Java-VM:

java -Dhttp.proxyHost=localhost -Dhttp.proxyPort=8888 ...

这篇关于Fiddler没有从Java应用程序捕获HTTP请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆