简体   繁体   English

服务器重定向太多次

[英]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.

相关问题 @PreAuthorize(“ isAuthenticated()”)重定向服务器太多次 - @PreAuthorize(“isAuthenticated()”) redirected server too many times 尝试使用 HTTPS 进行连接:服务器重定向次数过多 - Tring to connect using HTTPS: Server redirected too many times SOAP客户端 - ProtocolException:服务器重定向次数过多 - SOAP client - ProtocolException: Server redirected too many times Java HttpURLConnection问题:服务器重定向次数过多 - Java HttpURLConnection issue: Server redirected too many times java.net.ProtocolException: 服务器重定向次数过多 (20) - java.net.ProtocolException: Server redirected too many times (20) java.net.ProtocolException: 服务器重定向次数过多 - java.net.ProtocolException: Server redirected too many times 尝试检索 Sharepoint WSDL 失败,并显示“服务器重定向太多次” - Attempt to retrieve Sharepoint WSDL fails with “Server redirected too many times” java.net.Authenticator:java.net.ProtocolException:服务器重定向太多次(20) - java.net.Authenticator : java.net.ProtocolException: Server redirected too many times (20) 获取“java.net.ProtocolException:服务器重定向次数太多”错误 - Getting “java.net.ProtocolException: Server redirected too many times” Error SecurityFilterChain - http.authorizeHttpRequests() 不工作。 本地主机重定向你太多次 - SecurityFilterChain - http.authorizeHttpRequests() not working. localhost redirected you too many times
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM