0
I have a JOB in which I need to download files in order to use them.
My project is Java + JSF + CDI.
It happens that at the time of the execution of JOB I have no user logged in and the return of Facescontext is null, because I am not logged in.
I read in several places that I could inject Contextlistener (by using CDI), but I’m not succeeding.
How to get the web server address?
what 'path' are we talking about here? Do you say your application URL? I do not understand what would have to do to download files with knowing something that needs Facescontext.
– Israel Merljak
I search through ftp a file that is on another server and need to store it in a server folder so I can open it. For mpvè it I use Fileoutputstream fos = new Fileoutputstream(urlLocal); and then: ftp.retrieveFile(filename, fos) I download and send the file to this path. That’s why I need the server path...
– Marcelo Gomes
ta.. you need to tell which folder you want to save inside your application server. For that it wouldn’t be a URL in the sense
http://www.dominio/caminho/do/arquivo..
but a Path relative to the location of your project ex../pasta/relativa/ao/local/de/execucao/arquivo.txt
– Israel Merljak
"Fileoutputsream" transforms the url into a relative path as if it were a server command line and does not work. I will try to delete the local recording and try to work with the file in memory. Thank you
– Marcelo Gomes