• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Deploy overwrites folder.

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a folder : Resources where all my images are, but also the images my Users added. Everytime I deploy a new .war file this gets overwritten, forcing my Users to upload their pictures again. Is there any way of solving this?
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes. Don't store those images inside the web application's context. Store them in some other directory.
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
More specifically, don't store the images that are coming from your user in a directory that gets overwritten during a deployment. Why would you?
 
Tristan Van Poucke
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But wherever i put the folder in my web folder, its being included in the build map. Wich tells me it will be overwritten on deploy.
And if I don't put it in my web folder I can't seem to reach the images from a page.
 
Paul Clapham
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Tristan Van Poucke:
And if I don't put it in my web folder I can't seem to reach the images from a page.

That's the second part of the fix. You'll need to write a servlet which receives an image name as a parameter and returns the image which it gets from the external directory.
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Or if your application server supports it, you can define an external directory where the images are located.
 
Tristan Van Poucke
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So what i understand from this, is that all I have to do is:
- Create a folder on my server f.e. UserResources
- Get all the images added by users from there directly using the full URL
f.e. http://MyServer:8080/UserResources
- Do not add this map in my war file.
And this problem should be solved right?
[ October 01, 2008: Message edited by: Tristan Van Poucke ]
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tristan, if you were responding to my suggestion, then the tasks would be:

1) Create a directory in the host, say /opt/image
2) Configure the app server such that the context /UserResources, accessible via the URL http://MyHost:8080/UserResources, maps to the directory /opt/image
3) Ignore the /opt/image directory when creating the WAR

I prefer the term 'host' because it implies the physical (or virtual) machine on which the application server is running. I have seen the term 'server' used to mean the host in some cases and the application server in others, so the term 'server' tends to be ambiguous, which is not good when discussion precise configuration.
 
reply
    Bookmark Topic Watch Topic
  • New Topic