How do I login and download a file from a https web page from Java?

后端 未结 5 1827
长情又很酷
长情又很酷 2021-02-06 17:30

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

        
5条回答
  •  一生所求
    2021-02-06 18:06

    I agree with Alnitak that the problem is likely storing and returning cookies.

    Another good option I have used is HttpClient from Jakarta Commons.

    It's worth noting, as an aside, that if this is a server you control, you should be aware that sending the username and password as querystrings is not secure (even if you're using HTTPS). HttpClient supports sending parameters using POST, which you should consider.

提交回复
热议问题