I get the below exception when running from application but when i run as stand alone i get the rest call response place help me solve this problem.
java.net.ProtocolException: Server redirected too many times (20)
public static void main(String args[]) throws Exception{
String input = new String();
Authenticator.setDefault(new MyAuthenticator());
StringBuffer url = new StringBuffer();
url.append("https://rest-call-server-URL");
URL page;
try {
page = new URL(url.toString());
URLConnection conn = (URLConnection) page.openConnection();
conn.connect();
BufferedReader in = new BufferedReader(new InputStreamReader(
conn.getInputStream()));
String inputLine;
while ((inputLine = in.readLine()) != null) {
input+=inputLine;
System.out.println(inputLine);
}
in.close();
// out.close();
//parseXmlList(input);
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}