write files to relative path

2016-02-03 Thread Karl-Heinz Golz
Hi, sorry for my simple question. I have already wasted some time but it seems I have a blackout and therefore I want to ask you. I need to write files to a folder XXX relative to the application classes: XXX StartApplication.java HomePage.java HomePage.html ... The question is ??? in:

Re: write files to relative path

2016-02-03 Thread Ernesto Reinaldo Barreiro
Hi, StartApplication.class.getResource("HomePage.html").getUrl.getFile? Or something similar? Mind that this might be inside a temp folder that will be blown up next time you restart On Wed, Feb 3, 2016 at 2:08 PM, Karl-Heinz Golz wrote: > I'm using Tomcat 8. >

Re: write files to relative path

2016-02-03 Thread Karl-Heinz Golz
I'm using Tomcat 8. Writing to an absolute path (even outside of the application) works well: fos = new FileOutputStream("/home/XXX/file1.jpg"); Therefore I assumed that it should be possible inside of the application, too. I thought my problem is to correctly figure out the relative path. Am

Re: write files to relative path

2016-02-03 Thread Karl-Heinz Golz
thank you very much, now it works well with: fos = new FileOutputStream(StartApplication.class.getResource("XXX").getPath() + "file1.jpg"); Am 03.02.2016 um 14:25 schrieb Ernesto Reinaldo Barreiro: > Hi, > > StartApplication.class.getResource("HomePage.html").getUrl.getFile? Or > something

Re: write files to relative path

2016-02-03 Thread Ernesto Reinaldo Barreiro
Maybe I'm mistaken but I doubt in some application servers you might be able to do that On Wed, Feb 3, 2016 at 1:27 PM, Karl-Heinz Golz wrote: > Hi, > sorry for my simple question. I have already wasted some time but it > seems I have a blackout > and therefore I

Re: write files to relative path

2016-02-03 Thread Tobias Soloschenko
Hi, I think it is a problem of the response headers - you can also stream it from database with an AbstractResource and apply custom headers so that fancybox is handling it the way you want. Anyway to store it first is not good at this point also because of performance. kind regards Tobias

Re: write files to relative path

2016-02-03 Thread Tobias Soloschenko
Hi, why do you want to write something into the path of a temporary deployed web application? The file is going to be erased after redeployment of your webapp. I would consider a temp folder or a "working folder" for those files. kind regards Tobias > Am 03.02.2016 um 14:48 schrieb

Re: write files to relative path

2016-02-03 Thread Karl-Heinz Golz
Hi, actually I use it as temp folder and it is OK when it is going to be erased after redeployment. The business case is I want to show images via fancybox. I did that so far via dynamic link and when a user clicks a small image the data of the big image are delivered in onClick (read from