Hi all,
We have an application that run a Java Agent that needs to access an URL. But we will migrate the application to another Domino Server with a Single Sign On, and with the single sign on the Java Agent is not able to open the URL because it is configurated to as basic authentication.
Could you help me please?
See the code that we are using:
import java.io.*;
import java.net.*;
public class GetHTML {
public static String getHTML(String urlToRead, String encodeUserPassword) {
URL url; // The URL to read
HttpURLConnection conn; // The actual connection to the web page
BufferedReader rd; // Used to read results from the web page
String line; // An individual line of the web page HTML
String result = ""; // A long string containing all the HTML
try {
url = new URL(urlToRead);
conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setRequestProperty ("Authorization", "Basic " + encodeUserPassword);
rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
while ((line = rd.readLine()) != null) {
result += line;
}
rd.close();
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
}
Thank you!