java.io.IOException:服务器返回的HTTP响应代码:URL的406

问题描述 投票:0回答:1

java.io.IOException:服务器针对URL:https://aa09616289afe6a25ea1f7f6fbf12073:[email protected]/admin/api/2020-04/products.json返回了HTTP响应代码:406在sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1840)在sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)在sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)在java.net.URL.openStream(URL.java:1045)在javaapplication9.Send_HTTP_Request2.call_me(Send_HTTP_Request2.java:33)在javaapplication9.Send_HTTP_Request2.main(Send_HTTP_Request2.java:21)

myCodeURL url =新URL(“ https://aa09616289afe6a25ea1f7f6fbf12073:[email protected]/admin/api/2020-04/products.json”);

       BufferedReader read = new BufferedReader(
    new InputStreamReader(url.openStream()));
    String i;
    while ((i = read.readLine()) != null)
        System.out.println(i);
    read.close();
java json url
1个回答
0
投票
猜测通过Java代码发布的请求中缺少某些标头。

检查邮递员发布的所有标头是什么,还在Java代码中添加相同的标头(单击邮递员中的标头/代码链接以查看已解析的标头)

© www.soinside.com 2019 - 2024. All rights reserved.