0

I have a jersey web service. I am trying to download a file on my hard disk through my localhost Tomcat server.

window.open("D:\\mario.zip");

This line doesn't work due to security reason. My 2nd try is creating a folder in the project which can be accessible like localhost/myfolder then I put a file there which can be accessed through http. Now I copy files from a specific folder to "myfolder" so that they can be downloaded.

The problem is: although the files exist in my hard drive, they cannot be accessible through http. Only after I refresh the project in Eclipse. The files can be accessible through http.

Is there any trigger for the server to update its file list?

dtxd
  • 49
  • 2
  • 11
  • 3
    `window.open`? Are you confusing Java and JavaScript? – chrylis -cautiouslyoptimistic- Apr 13 '15 at 11:11
  • If you can directly access a file through javascript, then what's the point of Security? No such browser will let you directly access a file through javascript unless permitted by the User .. – The Coder Apr 13 '15 at 11:23
  • I have updated my question. I only try to access a file in a "broadcasted" folder on my server. I use Java to copy my file from the specific folder to the "broadcasted" folder for downloading. – dtxd Apr 13 '15 at 14:48

1 Answers1

0

How do you create "Aliases" in Apache Tomcat?

This is the answer. I don't know much about other solution than creating an "alias" as in Apache server. Olaf Kock's answer would be interesting too if he can be more beginner-friendly.

Further notice, you can find server.xml in your Tomcat server "project" in Eclipse.

Community
  • 1
  • 1
dtxd
  • 49
  • 2
  • 11