How to add a header line to a URL?
I have written an application which connects to a web page and extract some information from it.
I use something similar the following code to get this done.
URL url = new URL("http://www.google.ca");
System.out.println("created URL");
url.openStream();
System.out.println("opened stream");
// reads the contents of the web page here
The web page that I抦 connecting to has recently been made password protected.
Now I抦 required to include the following header line to my request in order to connect to it.
Authorization: Basic <base64-encoded-username:password>
Could somebody please tell me how to extend the above code to request the same web page with this particular header line?
Note that my application is a regular Java app. I cannot and am not using J2EE stuff here.
Thanks in advance!

