user1285928
user1285928

Reputation: 1476

How to download file in JSF page

I want to create JSF page which downloads Glassfish log files from the directory /opt/glassfish3/glassfish/domains/domain1/logs/

I found this Primefaces tutorial. I'm interested is there any possible way to make the same result with pure JSF?

Upvotes: 0

Views: 550

Answers (2)

him
him

Reputation: 608

Take a look at JCA, and look around for a good JCA adapter that provides file i/o. if you're working in a Java EE app, you probably want the transactional advantages that a properly implemented JCA adapter can/should provide (ACID, rollback, etc.) also, using a resource exposed by the container rather than "going native" will allow deployment security to operate properly wrt touching resources outside the container (files, sockets, etc.).

Upvotes: 1

Pedro Nunes
Pedro Nunes

Reputation: 420

For a really simple solution, you can create a link (using ln) to the desired log file somewhere in your web application.

cd /path/to/your/webapp/

ln /path/to/your/logfile.log .

With that you can access it directly with an URL;

http://yourServer/path-to-your-webapp/logfile.log

Upvotes: 0

Related Questions