tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Moises Lejter" <mlej...@teamsoftinc.com>
Subject WAR deployments and uploaded files...
Date Wed, 02 Aug 2006 18:19:31 GMT
Imagine that you wanted to allow the user to upload files to your web
app, that you then wanted to save - say for example web pages that you
wanted them to upload to your web app to display...

 

My first thought was, my web app can only write to /WEB-INF, so I should
put these files there.  Which I can do - but the inside of /WEB-INF is
not visible to the web browser, so I also need a servlet that will read
these files out of /WEB-INF to send to the browser, as appropriate.
Cumbersome.  So my second thought was, tomcat will let me write
elsewhere inside my web app, so I should just create a folder inside my
web app's doc root, and just put these files there.  Browsers will just
access these files by name, inside their folder, like they access every
other page on my web app.  Ok - though I am not sure I am supposed to
write inside my web app, but outside /WEB-INF...

 

However - I am deploying my web app using a WAR file.  So, I cannot
assume I can write anywhere, if I am deploying out of a WAR - unless the
web server expands the WAR on deploy.  So I set up tomcat to do that...
Only to discover that when the WAR file is updated, tomcat will remove
the existing expanded WAR file, in order to redeploy the application -
and incidentally removing all those pages my users so carefully
uploaded... L

 

The third thing that occurs to me is just to put the files somewhere
outside the web app... But then users could not get to them, unless I
write a servlet to go get them for the user, and send them back (as in
my first idea above).  This strikes me as non-portable...

 

So... The fourth thing that occurred to me was to save the pages in a
database, then write a servlet to retrieve them from the database to
deliver to the user ... Which seems like too much work...

 

Is there a best practice I should be considering here?

Thank  you!

Moises

 

 

 

Moises Lejter

 

Phone: 608-827-7772 

Email: mlejter@teamsoftinc.com

 


Mime
  • Unnamed multipart/related (inline, None, 0 bytes)
View raw message