Hellow everyone,

I have this Java Method below. I used a link which requires authentication and when I ran this in Eclipse, it worked well.


However, when I deployed this in Weblogic, the method returns an error which was " 401Unauthorized".

I tried this link but did not work:


Can you please give me some suggestions regarding this?

Thanks in advance

private static boolean validURL(String docpath)
        boolean fileExists = false;
            URL u1 = new URL(docpath);
            java.io.InputStream testStream = u1.openConnection().getInputStream();
            fileExists = true;
        catch(IOException e)
        return fileExists;

Can you look at what the server receives when you try to access it with that URL?
What happens if you use that URL in a browser?

I don't know if the URL class has the logic to do the steps needed to respond to a 401 response by generating the Authorization: field in the HTTP response header.