This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I'm assuming you have the username and password available on the local machine? You need to make an initial request that pretends to be the data submitted from the login page. When this page returns it will give you a session ID. Then you attach this session ID to subsequent addresses. You'r going to have to look into some of the HTTP protocol. Login requests are usually POSTed, and the session ID is maintained as a Cookie in the request header. It shouldn't be too dificult, but I don't have anything handy to help at the moment. Hopefully someone can post some code demonstrating POSTing via a URLConnection, stripping a Cookie, and sending a Cookie via another Connection? Dave
what david is basically saying is that you need to write a microbrowser that does "enough" to create the POST and do the networking. your code is really jsut using the transport layer - but you need to provide a skeletal implementation of the browser client (IOW a request generator and response handler) to do what you are asking for.