G N [https://community.jboss.org/people/kgena] created the discussion

"Dynamic Proxy Discovery"

To view the discussion, visit: https://community.jboss.org/message/796862#796862

--------------------------------------------------------------
Hi

I am using JBoss 4.2.3. Is there any way to dynamically discover HTTP proxy 
setting of the machine that hosts the JBoss server.

Unfortunatelly, the following code does not discover correct information.

| 
 | 
 | System.setProperty("java.net.useSystemProxies", "true"); |
| 
 | 
 | List<Proxy> listProxies; |
| 
 | 
 | try { |
| 
 | 
 | 
 | listProxies = ProxySelector.getDefault().select( |
| 
 | 
 | 
 | 
 | 
 | new URI("http://www.google.com/";)); |


| 
 | 
 | 
 | for (Proxy proxy : listProxies) { |
| 
 | 
 | 
 | 
 | 
 |
| 
 | 
 | 
 | 
 | InetSocketAddress addr = (InetSocketAddress) proxy.address(); |


| 
 | 
 | 
 | 
 | if (addr != null) |
| 
 | 
 | 
 | 
 | { |
| 
 | 
 | 
 | 
 | 
 | System.setProperty("http.proxyHost", addr.getHostName()); |
| 
 | 
 | 
 | 
 | 
 | System.setProperty("http.proxyPort", addr.getPort()+""); |
| 
 | 
 | 
 | 
 | 
 | System.setProperty("https.proxyHost", addr.getHostName()); |
| 
 | 
 | 
 | 
 | 
 | System.setProperty("https.proxyPort", addr.getPort()+""); |
| 
 | 
 | 
 | 
 | } |
| 
 | 
 | 
 | } |


| 
 | 
 | } catch (URISyntaxException e) { |
| 
 | 
 | 
 | log.error("Failed to ininitilzie proxy settings", e); |
| 
 | 
 | } |


Thanks
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/796862#796862]

Start a new discussion in Beginner's Corner at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075]

_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to