I am using this program in JAVA to get a csv file from the specified URL, but only problem is that it requires username and password that I know, how can I modify this program to include username and password?
public class TestGetCSV {
public static void main(String[] args) {
try {
URL url12 = new URL("https://wd5-impl-services1.workday.com/ccx/service/customreport2/yahoo3/ISU-YINT061-ProjectsFE/YINT061.05-getWorkersForOpenText?format=csv" );
URLConnection urlConn = url12.openConnection();
HttpURLConnection conn = (HttpURLConnection)urlConn;
conn.setInstanceFollowRedirects( false );
InputStreamReader inStream = new InputStreamReader(urlConn.getInputStream());
BufferedReader buff= new BufferedReader(inStream);
String content2 = buff.readLine();
while (content2 !=null) {
System.out.println(content2);
content2 = buff.readLine();
}
}
catch (Exception e){
e.printStackTrace();
}
}
}