0

I have a java web application running on Websphere App Server and I want my users to download a file from another server at some certain point in my application.

For example when the user is at http://www.a.com, I want him to download http://www.b.com/file.txt without his interaction. I know that it is not possible via javascript because of CORS and so far, I could just think of Java applets.

Can you suggest me any other way to make my users download a file from another server without interaction? After he downloads the file, I am going to get this file to my own server(http://www.a.com)

Thank you

Alpay
  • 1,350
  • 2
  • 24
  • 56
  • the servlet itself could ftp the file from b.com and then you could stream it from a.com unless it is static then you could just reference it from your HTML – Scary Wombat Oct 12 '16 at 06:32
  • @ScaryWombat Thank you for your comment, but I want the user to download it, otherwise b. com will see a.com' s IP at all requests. The user himself should be the one who is requesting the file. And file is not served by FTP protocol. It is served on a web page so I should download it with HTTP request. – Alpay Oct 12 '16 at 06:34
  • so why not just include it as a `href` on your html ? – Scary Wombat Oct 12 '16 at 06:41
  • @ScaryWombat if i did that, user will download this file to his PC that' s ok, but how am i going to get this file from his PC without his interaction? – Alpay Oct 12 '16 at 06:45
  • Hope this can help you. http://stackoverflow.com/questions/29712554/how-to-download-a-file-using-a-java-rest-service-and-a-data-stream – Anthony Oct 12 '16 at 06:56
  • @Anthony this is a completely different scenario, in fact. What i want is to make the user download a file from a different source, but here, they are trying to achieve server-to-server file downloading – Alpay Oct 12 '16 at 08:44

0 Answers0