I have to login into a https web page and download a file using Java. I know all the URLs beforehand:
baseURL = // a https URL;
urlMap = new HashMap
I'd say have a look at Java CURL http://sourceforge.net/projects/javacurl. I have used it before to login into an https website and download stuff, it has features such as spoofing the browser id etc. Which might solve your issue of getting redirected back to login.
Although they provide an eclipse plugin for it I have used it without and it works fine.
Alternatively you could use wget and call it from java.