Force java web start to use a proxy like Fiddler without touching code

假如想象 提交于 2019-12-08 03:09:31

问题


For a automatic software project i need some requests and responses from a Java Web Start application.

So i installed Fiddler Web Debugger and then i tried to use this fiddler proxy to sniff all requests.

The problem is the Java Web Start application.

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"/>

The application would ignore it.

Then i tried to set up the Java settings.

It doesnt works, too ;(

Wireshark cant decrypt the https/ssl requests...

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.

Why java cant use the system proxy? >.>


回答1:


There a different ways how to do it:

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.) 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.) 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 );


来源:https://stackoverflow.com/questions/24842412/force-java-web-start-to-use-a-proxy-like-fiddler-without-touching-code

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