wood burning stoves*
The moose likes Servlets and the fly likes server directories Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "server directories" Watch "server directories" New topic
Author

server directories

Asad Kazmi
Greenhorn

Joined: Feb 05, 2010
Posts: 2
HI,

first of all sorry for asking such an easy question , but it is bugging me for a long time..

actually i am building a web application in which user has the ability to upload his images under directory

web-inf
-->images

now these images can be viewed online bcz they are under web-inf...but the problem is i am working on production server and i have to replace the war after some changes or bug fixing. what ever images user has uploaded will be deleted as i replace the war..

if i save these images outside the server then . obviously i cant access them online...only if i copy them back in web-inf again and then give link to user..

can anybody suggest me what should b the suitable solution for this problem-..and i dont want to store images in database.. :-)
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Sure you can--stream the images to the user with a servlet (or whatever back-end technology you're using).
Asad Kazmi
Greenhorn

Joined: Feb 05, 2010
Posts: 2
actually . !
let me explain you the whole scenario...i dont want to save image under
webinf/images/
..because i am continuously updating and war file by replacing it..if i store image in image folder then what ever is in that folder will be deleted when i will replace it with the new one.......so what i did, i place images in some other folder say
c:/userUploadedImage
now i want to show the stored image to the online user in html image tag.....
....as you can understand..the image stored at c:/... cant be shown online.....right ?
so what i am doing is that i am copying the requested image from c:/... to webinf/images. when user need that image to view it....
that might sound bad...
but this was quiet easy to implement...and the servlet approach doesnt fits in the scenario anywhere... ??? perhaps may b i am missing some thing...
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60782
    
  65

Asad Kazmi wrote:web-inf
-->images

WEB-INF, not web-inf.

can be viewed online bcz they are

Please use real words when posting to the forums. Abbreviations such as "bcz" in place of "because" only serve to make your posts more difficult to read and less likely to generate useful responses.

Please read this for more information.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60782
    
  65

Asad Kazmi wrote:and the servlet approach doesnt fits in the scenario anywhere... ??? perhaps may b i am missing some thing...


Again, real words please. And proper punctuation and capitalization. Programming is all about attention to detail and accuracy. Please show the same care in your posts that you would show in your code.

Yes, you are missing something. The servlet can read the image file anywhere off the file system and stream it as the response.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: server directories
 
Similar Threads
deploying .war and .jar files separately
Web application deployment
GWT .war file building problem (Ant Build)
how to install tomcat 5.5 in windows vista
Trying to deploy a war file with datasources to JBoss