Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Saving permanent Files
I'm having the following Problem.
As I already know, when undeploying, or after redeploying an application, glassfish deletes all data of the application.
What I want to have is a permanent directory of images, every instance of the application can access (for upload reason).
In http://vaadin.com/forum/-/message_boards/message/98616 this was already discussed, but I don't want to use the User's home dir, because the server I deploy in the end will be a Windows Server, and nobody will look for such a directory in the users home dir on Windows.
Is there a possibiliy to make a directory in the Glassfish domain itself?
I am using Glassfish v3.
what goal you wantto achieve with this directory ?
If you plan to store application settings and data files - user.home , IMO, is a better solution, as it is more permanent. And typically nobody will manually look at that folder but your application business beans.
However, if you want to use glassfish domains folder - this is also possible - path to domain application is running in is available in one of glassfish systemproperties. I don't recall what exactly, but if you'll print all properties and their names from your app, say, into stdout, via System.getProperties(), you'll see that variable.
Another option is to use glassfish domain folder or user.home by default but make it overridable via your own system property you can then specify in glassfish domain.xml as -Dname=value jvm option.
Thank you very much for your quick response.
In order that you understand my goal, I describe how my application works.
I have a database connected. Every row in the database creates a Button in vaadin. This button uses an Image. The name of the image is stored in the database. The database is filled by an automation software, which doesn't have anything to do with web servers.
So if you e.g. make want to have another switch for turning the light on in your room, you just add a line in the database, and an image to the image folder.
BUT for surprise :) after deploying another version of my application, the image is gone.
So this image must be permanent, it must not vanish.
You see, the automation developer simply does not care about that I am using a very sophisticated web technology, where a website is "deployed" as application. There are many advantages of this concept, but sometimes I must simulate some aspects of the the application to be old-scool php-like "static".
Probably it is worth to stora images in some shared network folder where both automation developer and your webapp will have access to ?
Or you can just to share a local folder, just let your app to read a system property where you can put the path to that folder and if property is not present - use some default value
I forgot to say that I am implementing an upload feature.
Currently, admin-users can create new buttons using a form in vaadin.
There you can specify the automation data-point and the icon.
So everyone that is adding data-lines in the database can upload the images using this form.
I have another question:
user.dir is the glassfish domain folder and not the home folder of the webaccess-user?
btw: You all give the best support I encountered so far in any field of IT. Good work people. :)
user.dir might be a domain folder or jvm bin folder but I'd recommend to use glassfish's own system property which is more accurate and more guaranteed to point to domain home.