2

I am using Wildfly 9.0.2.Final, while in development, all my files that uploaded via my web service and stored in resources/images are gone when I perform a full-publish (luckily this are development dummy images). In production, where is the best place to store or best practice to prevent files/images from missing?

VHanded
  • 2,079
  • 4
  • 30
  • 55
  • 1
    See if this answer will help http://stackoverflow.com/questions/34426082/how-can-i-serve-static-resources-from-outside-a-war-on-wildfly. But you are touching on multiple aspects here. Try answering these questions - a) security - are all users allowed to see/download the files back. If not then you will want one of your controllers to check permission before access is allowed. b) search functionality - maybe further indexing is required. c) backup d) possibly manymore... – vijay Jul 05 '16 at 06:38
  • @vijay Thanks! I am not looking for security, no credential is required. It needs to be able to backup easily. Each URL will be stored in my db. – VHanded Jul 05 '16 at 09:01

1 Answers1

1

If the files belong somehow to your application, place the somewhere inside the web application (and outside of WEB-INF). They will be accessible through the respective URL path.

If your application needs to store user data that gets uploaded dynamically during application runtime and shall persist even if you redeploy the application, then you better have a configurable directory on disk. One default option to find the JBoss/Wildfly data directory could be to query for the system property 'jboss.server.data.dir'.

Queeg
  • 7,748
  • 1
  • 16
  • 42