Eclipse proxy implementation, NTML [message #891919] |
Tue, 26 June 2012 10:59  |
Eclipse User |
|
|
|
Wondering how Eclipse implements proxy authentication....
Sit behind a company firewall that uses our NetId smartcard for authentication when calling the outside world via a proxy. Eclipse needs a host, port, provider equal to Manual, and Auth equals to false in my network setting to get at update sites. How is this implemented? Reason I ask is that I having trouble making NTML credentials with Apache HTTPClient and thought the Eclipse IDE likely has a Java implementation that I can learn from.
mvh / Matthew Young
|
|
|
Re: Eclipse proxy implementation, NTML [message #891925 is a reply to message #891919] |
Tue, 26 June 2012 11:23  |
Eclipse User |
|
|
|
Likely answering my own question. But apparently the HTTPUrlConnection class does the credential stuff automatically as long as the http.proxyHost and http.proxyPort system properties are set. Just tested:
String url = "<destination>", proxy = "<our proxy>", port = "8080";
URL server = new URL(url);
Properties systemProperties = System.getProperties();
systemProperties.setProperty("http.proxyHost", proxy);
systemProperties.setProperty("http.proxyPort", port);
HttpURLConnection connection = (HttpURLConnection) server.openConnection();
connection.connect();
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
Assuming Eclipse uses HTTPUrlConnection while HTTPClient doesn't.
|
|
|
Powered by
FUDForum. Page generated in 0.05903 seconds