简体   繁体   English

HTTP响应码403问题

[英]HTTP Response code 403 Issue

I am getting 我正进入(状态

Http 403 code When I try to access that URL using my application Http 403 code当我尝试使用我的应用程序访问该URL时

 URL url = new URL(path);
     url.openStream();
          URL url = new URL(downloadURL);

    /*URLConnection conn = url.openConnection();
    conn.setRequestProperty("User-Agent", "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9.2.2) Gecko/20100316 Firefox/3.6.2");*/

    HttpURLConnection httpcon = (HttpURLConnection) url.openConnection(); 
    httpcon.setRequestProperty("User-Agent","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.102 Safari/537.36"); 





    httpcon.connect();
    //url.getFile();
    InputStream is = httpcon.getInputStream();
    //InputStream is = conn.getInputStream();

But I can open the URL which I am using in my application .. 但是我可以打开我在应用程序中使用的URL。

Can anybody please help 有人可以帮忙吗

I can access that URL In my browser... 我可以在浏览器中访问该URL ...

That URL is from some server(local) not public. 该URL来自某个不公开的服务器(本地)。

URL url = new URL(path);
URLConnection conn = url.openConnection();
conn.getInputStream();

Try this way. 尝试这种方式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法加载导入的本体HTTP响应代码:403 - Could not load imported ontology HTTP response code: 403 部署 Google App Engine 后返回 HTTP 响应代码 403 - After deploy Google App Engine returns HTTP response code 403 服务器返回的HTTP响应代码:403(适用于URL)Google Translate API - Server returned HTTP response code: 403 for URL Google Translate API Angular 5:预检的响应具有无效的HTTP状态代码403 - Angular 5: Response for preflight has invalid HTTP status code 403 SOAP消息到webservice - HTTP响应代码:403用于URL - SOAP message to webservice - HTTP response code: 403 for URL 解决获取HTTP响应代码403的HtmlCleaner问题 - Resolve HtmlCleaner issue of getting HTTP respond code 403 Java Http(s)URLConnection java.io.IOException:服务器返回 HTTP 响应代码:403 - Java Http(s)URLConnection java.io.IOException: Server returned HTTP response code: 403 在Java代码中获取“ java.io.IOException:服务器返回的HTTP响应代码:URL的403:” - Getting “java.io.IOException: Server returned HTTP response code: 403 for URL: ” in java code HttpUrlConnection标头的响应代码为403 - HttpUrlConnection headers response code is 403 java.io.IOException:服务器返回HTTP响应代码:403表示URL - java.io.IOException: Server returned HTTP response code: 403 for URL
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM