0

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?

user1285928
  • 1,328
  • 29
  • 98
  • 147
  • You can create your own Download-Servlet which serves you whatever data you want, it only has to be accessible (on server side) from within your application server. – Dominik Sandjaja Aug 24 '12 at 15:02
  • 1
    possible duplicate of [How to stream a file download in a JSF backing bean?](http://stackoverflow.com/questions/9391838/how-to-stream-a-file-download-in-a-jsf-backing-bean) – Luiggi Mendoza Aug 24 '12 at 15:03

2 Answers2

1

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.).

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
him
  • 608
  • 5
  • 15
0

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
Pedro Nunes
  • 410
  • 2
  • 5