Reputation: 13
I try to load a Audiofile via an URL and HttpsURLConnection. I tried the solutions on the other tickets without success. Her is what I did:
System.setProperty("http.maxRedirects", "100");
java.net.CookieManager cm = new java.net.CookieManager();
java.net.CookieHandler.setDefault(cm);
HttpsURLConnection conn = (HttpsURLConnection) new URL(audio).openConnection();
conn.setFollowRedirects(false);
InputStream ins = conn.getInputStream();
audio is a URL to an audio file. Something like https://example/03434D11E3526D.WAV. If I put the URL in my Browser I can download the audio file.
Stacktrace:
17:00:03,913 ERROR [de.example.testing.AudioTest] (EJB default - 1) testnr: 949: java.net.ProtocolException: Server redirected too many times (20) at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1932) at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1520) at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:250)
... internal Classes
Upvotes: 0
Views: 41