On Thu, 10 Mar 2011 19:24:52 -0300, Rich M <rich...@moremagic.com> wrote:

Primarily because I can't think of a reasonable way to build a URL to the file that could actually be served. I wish I was more knowledgeable about servlets and such, but if my application is running from a WAR, how would I get any files into that context? In development I use maven directory structure and the mvn jetty:run command to execute. From here I know I can place files relatively from my context in src/main/webapp/<where-ever> and serve it as an Asset. However, when I have to deploy it into production and run it as a WAR in stand-alone Jetty, I think this approach is no longer viable.

I think you have a confusion here. The folder structure you use while developer doesn't matter, the one in the WAR, exploded or not, does. Servlet containers normally exploded (unzip) your WAR into a folder. Anything inside that folder is available. Example: if you have a image.jpg file inside the root folder of the root context, it's URL is at http://domain/image.jpg directly. Better yet, most servlet containers (at least Tomcat and Jetty) support WARs: you don't even create a WAR file, just put the contents of it inside some configured folder.

In other words: if you upload your files to the root folder of your application in the server, they're in the context and can be reached by users.

You'd use a StreamResponse if you stored your files in a database instead of the file system.

--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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

Reply via email to