Using groovy/java to verify protected image (need username/password)
Hello, I need to verify a url which has protected images and requires a username/pass. Trying the url in the browser causes a popup asking for username/password. I have heard that you need to add the username/pass to the http header etc. How can I do this in groovy / java.
my current code for open images url is URL url = new URL(myurl); def foo = new java.net.URL( myurl ).openStream() foo.close()
Sounds to me like the Web Server is using HTTP Authentication, which comes in two variants, Basic and the more advanced Digest. You can tell which one is used by looking at the response headers when issuing the request without any authentication.