I am getting below error while trying to fetch documents from external document storage system through my gosu class
java.io.lOException: Server returned HTTP response code: 403 for URL: https://XXX at sun.net.www.protocol.http.HttpURLConnection.getlnputStream0(HttpURLConnection.java:1919) ~[?:?] at sun.net.www.protocol.http.HttpURLConnection.getlnputStream(HttpURLConnection.java:1515) ~[?:?] atsun.net.www.protocol.https.HttpsURLConnectionlmpl.getlnputStream(HttpsURLConnectionImpl.java:25 0) ~[?:?] at java.net.URL.openStream(URL.java:1139) ~[?:?]
Once storage system receives the document an url is shared to access it. Have found that if we access the url through a web browser we are able to retrieve the document.
Another thing is that this is an env specific issue, code is working fine in other envs. Have checked with network and storage team and they have confirmed that there’s no issue from their side. Any idea on probable cause foe this issue and how to handle it?
Have tried adding .addRequestProperty() in request but received same error then used .setRequestProperty() which is throwing java.lang.IllegalStateException: Already connected error
Ashwini kumar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2