I'm developing an application using JAVA EE 6, more specifically, Glassfish v3.1.2.2.
Before, I used to put images and files uploded by users in my database. this would make it easier in case I ever wanted to clusterize my architecture by adding nodes.
Now, I'd really like to stop doing that and just save my uploaded files to my resources folder (for many reasons such as this), so that a simple <img>
or <h:graphicImage>
with a name will do the trick.
My question is how does this work when I add other servers? The file will only be saved to the server's resources folder that handles the request, the other servers won't have it.
Now maybe someone would suggest using a distributed filesystem, which sounds great except in cases where you are renting some hosting/cloud service for your app and you can't really choose your filesystem. (There could be other reasons that prevent you from turning to this setting)
Does JAVA EE offer any way of transparently synchronizing your resources folder? JSF already handles versioning of it and managing libraries etc, any chance I can set up some configuration so all my servers keep their resource folders up to date with any file changes/uploads?
If not, what are the alternatives?