bucafett2000
Programmer
I am attempting to access a file with the java.net.URL data type in WAS on OS390 with athentication on.
I get java.net.ProtocolException: Server redirected too many times (5) when it gets to the getInputStream() call.
Any help on solving this would greatly be appreciated. Thanks!
Adam
Code:
Authenticator.setDefault(new BTSAuthenticator());
URL url = new URL("[URL unfurl="true"]http://mylocation/file.txt");[/URL]
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
connection.setFollowRedirects(false);
connection.connect();
InputStream input = connection.getInputStream();
...
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication("username", "password".toCharArray());
}
I get java.net.ProtocolException: Server redirected too many times (5) when it gets to the getInputStream() call.
Any help on solving this would greatly be appreciated. Thanks!
Adam