I am developing a Java application that makes HTTP requests, and half of my development time is behind a proxy. So I have the following block in my code:
if (BEHIND_PROXY) {
java.util.Properties systemProperties = System.getProperties();
systemProperties.setProperty("http.proxyHost", PROXY_HOST);
systemProperties.setProperty("http.proxyPort", PROXY_PORT);
}
The idea is that I change the value of BEHIND_PROXY
based on where I am. I was working today, not behind a proxy, and forgot to set BEHIND_PROXY
to false
. However, the connection was still made successfully and my application received the data it requested. How is this possible? Is there something built into this, that if the proxy server cannot be reached, it simply tries again but bypasses the proxy on this retry?
And a second question, I have been trying to find a complete list of system properties. I have found many posts like THIS one, but not one of them lists http.proxyHost
or http.proxyPort
, which makes me think they are clearly not very complete. Am I searching wrong somehow? Do these http.x
properties belong in these other lists? Is there a more complete list somewhere?