I trying to make simple web Application (JSF2 + Tomcat7). I have an idea to make reports as *.pdf file in the specified directory and than redirect client to that file.
I have configured Tomcat to "see" directory /data/uploads by address http://localhost:8080/uploads and it's work fine. I can view content of file /data/uploads/sample.txt as /uploads/sample.txt.
I tried to write content in text file via method of ManagedBean, but already have a few questions, that I can't find in any books:
- My test JSF application has
/jsfincubatoras context path. Is there any way to accesssample.txtvia path like/uploads/sample.txt, that is same toGETrequest path? I can successfully write to file by it's absolute path/data/uploads/sample.txt, but I want to abstract from absolute paths or make this path configurable. - How can I make link to file
/uploads/saple.txtfrom my test application? All my variations with links can't be resolved. - Is it possible to make ManagedBean's method, that will be write content into file and return the path of that file to redirect browser?
Thanks for wasting your time for me. Best regards.