强制 java web 开始使用像 Fiddler 这样的代理,而不用接触代码 [英] Force java web start to use a proxy like Fiddler without touching code
问题描述
对于自动软件项目,我需要来自 Java Web Start 应用程序的一些请求和响应.
For a automatic software project i need some requests and responses from a Java Web Start application.
所以我安装了 Fiddler Web Debugger,然后我尝试使用这个 Fiddler 代理来嗅探所有请求.
So i installed Fiddler Web Debugger and then i tried to use this fiddler proxy to sniff all requests.
问题在于 Java Web Start 应用程序.
The problem is the Java Web Start application.
我将它添加到 .jnlp 文件中,并希望它有效...它没有!:(
I added this to the .jnlp file and hoped that it works... It doesnt! :(
<property name="http.proxyHost" value="127.0.0.1"/>
<property name="http.proxyPort" value="8888"/>
应用程序会忽略它.
然后我尝试设置 Java 设置.
Then i tried to set up the Java settings.
它也不起作用;(
Wireshark 无法解密 https/ssl 请求...
Wireshark cant decrypt the https/ssl requests...
我可以做什么来解密请求或读取请求,或者让使用 java web start 应用程序作为 fiddler 代理.
What could i do to decrypt the requests or to read the requests OR to let use the java web start application the fiddler proxy.
为什么java不能使用系统代理?>.>
Why java cant use the system proxy? >.>
推荐答案
有不同的方法:
1.)您可以在 java 系统设置中设置代理.打开系统设置\Java\Java 控制面板\网络设置.在那里您可以配置代理...
1.) You can set the proxy in the java system settings. Open System Settings \ Java \ Java Control Panel \ Networksettings. There you are able to configure the proxy...
2.)验证您的代理是否配置正确的另一种可能性是检查您的 Java 程序:
2.) Another possibility to verify if your proxy is configured correctly is to check within your java programm:
private Proxy findProxy(URI uri)
{
try
{
ProxySelector selector = ProxySelector.getDefault();
List<Proxy> proxyList = selector.select(uri);
if (proxyList.size() > 1)
return proxyList.get(0);
}
catch (IllegalArgumentException e)
{
}
return Proxy.NO_PROXY;
}
3.)在您的程序中设置系统设置:
3.) Set the system settings within your programm:
System.getProperties().put( "proxySet", "true" );
System.getProperties().put( "proxyHost", "myProxyMachineName" );
System.getProperties().put( "proxyPort", "85" );
如果您还需要身份验证,请使用(更多详细信息这里)
If you need authentication also, use (more details here)
URLConnection connection = url.openConnection();
String password = "username:password";
String encodedPassword = base64Encode( password );
connection.setRequestProperty( "Proxy-Authorization", encodedPassword );
这篇关于强制 java web 开始使用像 Fiddler 这样的代理,而不用接触代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!