Alex Rivera | Logout

Without changing code, how to force httpClient to use proxy by environment variables or JVM arguments

Asked 2011-03-02T08:37:15.867
48

I found these system settings http.proxyHost and http.proxyPort are of no use to httpClient. How to force the httpClient to use proxy by environment variables or VM arguments or something like those without changing code?

Edit
Report

1 Answer

-18

Does this help?

System.setProperty("https.proxyHost", proxy_host);
System.setProperty("http.proxyHost", proxy_host);
System.setProperty("https.proxyPort", proxy_port);
System.setProperty("http.proxyPort", proxy_port);

Or ofcourse you can pass the same properties via the commandline

answered 2011-03-02T08:42:37.157

Your Answer