Link to home
Start Free TrialLog in
Avatar of DevelHelper
DevelHelper

asked on

How to download files from remote application server?

Do you know how to download files from remote application server? I don't know whether I need to create a session bean which returns a file back to the servlet and save it under webApplication, and then make a link to the file in jsp page to enable the user to download. But the problem is that how to clean those files.
Some of those files are lvery large. I'm looking for the best solution.

Thanks for the help in advance!

Avatar of Venci75
Venci75

you can use servlet:
response.setHeader("Content-Disposition", "attachment; filename=filename;");
response.setHeader("Content-Type", "application/octet-stream");

response.getOutputStream().write(); // white the file data
ASKER CERTIFIED SOLUTION
Avatar of doddjames
doddjames

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of DevelHelper

ASKER

In my case, EJB container and Servlet container are not same (different machines). So based on Dodddiames's suggestion, it doesn't request to save the file which return from the remote EJB session bean when make the following call, right?

OutputStream out = new FileOutputStream( file );