[英]Server redirected too many times
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) java.net.ProtocolException:服务器重定向太多次(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();
}
}
In all probability you have entered a redirect loop at the server. 您极有可能在服务器上进入了重定向循环。 The server responds with
303 See other
and when Java's URL connection implementation automatically "sees that other", the server responds again with the same response, and so on ad infinitum. 服务器以
303 See other
响应,并且当Java的URL连接实现自动“看到其他”时,服务器将再次以相同的响应进行响应,依此类推。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.