How do I connect to a URL using Basic authentication?
Author: Deron Eriksson
Description: This Java tutorial describes how to connect to a URL using Basic authentication.
Tutorial created using: Windows XP || JDK 1.5.0_09 || Eclipse Web Tools Platform 2.0 (Eclipse 3.3.0)
(Continued from page 1)
Code similar to ConnectToUrlUsingBasicAuthentication allows me to connect to my Linksys router and read the current IP address of my router. I can take this IP information and send it to a web application deployed on the web. As a result, I can then forward requests from the deployed web application through the router to my local machine. This technique requires me to forward requests to my router to port 8080 to my local machine on port 8080, as shown below.