Caldarale, Charles R wrote:
From: Eric P [mailto:eric.maill...@gmail.com]
Subject: Where to store uploaded user content in app

For example, in my application I was thinking I would create an empty directory under /web/WEB-INF for the non-web accessible
image uploads and another empty directory right under /web for
the web accessible images.

Bad idea.  You should treat the deployment area as read-only, at least from the 
webapp's perspective.  To be spec compliant, you can't even assume that the 
deployment area is part of the platform's file system.  Better to locate the 
necessary directories completely outside of Tomcat's directory structure, and provide 
system or <Context> properties to tell the webapp where to find them.

As far as serving the moderated images, it's easy to define a simple <Context>-only webapp 
for that location, and let Tomcat's DefaultServlet deliver the pictures.  Just create a 
<Context> element with a docBase attribute pointing to the approved image directory, and 
put the <Context> element in conf/Catalina/[host]/[imageURL].xml; no other structure or 
configuration is needed.

 - Chuck



Perfect.  This is exactly the kind of answer I was looking for.

Thanks, Chuck!

Eric

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to