I'm not sure I really followed, but your option "c" doesn't seem to have anything to do with a web framework (tapestry or otherwise). Rather you're just dynamically generating some text a la:
<img src="/MyOtherWebContext/images/my-dynamically-named-image.gif" /> Or whatever. The only part of that which is dynamic is the image name. And "Any" tag can give you this no sweat. Maybe the name of the other web context is a config param and so is "dynamic" too. Again, no sweat. As for the serving of the static files themselves (the name of a given file is "dynamic" in that if you're showing the details of a CD then the image name may depend on the product, but the image itself is in a web servers file system) any web server will do. Apache, Tomcat, JBoss, etc. I think the problem is with the word "stream". Stream implies dynamically feeding data into the response. I think your question is about serving images. If so, it's a snap. For example, I serve my "Tapestry" javascript files (same applies to images) simply as: <script type="text/javascript" src="/MyTapestryAppName/js/myJavaScriptFile.js"></script> Works great. Perhaps I misread the question. Thanks, Ezra Epstein -----Original Message----- From: Murray Collingwood [mailto:[EMAIL PROTECTED] Sent: Thursday, July 27, 2006 5:35 AM To: Tapestry users Subject: RE: Streaming files from Tapestry Hi all :THIS SOUNDS SIMPLE Thanks for the response detlef but I'm still short of a simple example. How complicated can it be to deliver binary files (such as images) from a webserver to a webclient? Why is it that I need to write my own engine service???? That sounds complicated and the mere fact that nobody else seems willing to provide the documentation to do this only serves to confirm my suspicion that it is complicated! Okay, so writing an engine service is complicated and nobody wants to document it. Instead I'm being asked to download an example application and then work out how the example works, to identify the required bits of code to do what I need and be able to copy and implement these in my application. :DOESN'T EVERYBODY NEED ONE OF THESE All of this despite the generic requirement that many web applications would have for storing and retrieving documents (images / blobs / etc). :SAMPLE CONFIGURATION SUGGESTION I realise this is an open source project so I would like to volunteer the configuration component necessary: <servlet> <servlet-name>servesBinaryFiles</servlet-name> <servlet-class>org.somebody.SimpleBinaryServlet</servlet-class> <load-on-startup>0</load-on-startup> <init-param> <param-name>binaryPath</param-name> <param-value>/home/application/storage</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>servesBinaryFiles</servlet-name> <url-pattern>/extimage/*</url-pattern> </servlet-mapping> All we need now is somebody who knows how to write the SimpleBinaryServlet to do so. Can we then add it into Tapestry and then we would have a solution that everybody could use. :HAVE I GOT IT ALL WRONG? Perhaps I've missed something? Is this too easy? If so then it won't take somebody very long to do, however as above, I'm still thinking along the lines that it's not that simple. Perhaps I've got it right? Is writing an engine service difficult? If so then how can our average web developer with a year or two of Tapestry experience be expected to do this? :MORE BACKGROUND ON WHAT THIS IS ALL ABOUT And finally, just so that everybody understands the application. Consider for example an online shop, we upload an image of a product. We can store that image (and perhaps a thumbnail variation) in one of three places: a) In the database as a BLOB (although a number of databases I have tried experience performance issues dealing with blobs) b) In a directory within my webapp root (this is a very dangerous location, if you undeploy an application it will delete everything under the webapp root - I've had this happen and it's not nice) Also, by definition the webapp root is simply an expansion of the war/ear, to store dynamic files in this location goes against that standard. Potentially an administrator should be able to delete the webapp subdirectories and they should rebuild by expansion of the war/ear files. c) In a directory external to my webapp root. Outside of my webapp root I'm not going to have any problems redeploying my application. Also, I can backup the data (the database and the external binary directory) separately from the programs - this is a good thing. And finally this method requires that I access each file via a program that can potentially check security settings before letting me view the file - this would be a requirement for any CRM style of system. If you don't have dynamic binary files (eg images associated with database records etc) then you can store static images in your war file, no problem. If your website only requires dynamic text (eg stored in a database) then you won't need any binary file management, again no problem. If you do require dynamic binary files then options (a) and (b) are not great, leaving only option (c). My hunch is that this is a common requirement of many web applications, certainly it has been of the sites I have developed over the years. :THE FINAL SUMMARY / SOLUTION My ideal solution is that Tapestry includes a servlet engine for serving these binary files (as per my configuration entries above - or similar). If I can't have the ideal the next best would be a library that provided this functionality that I could download. If I can't have a library to download, the next best would be a sample application on the faq page showing how the engine is written and configured. Sorry this has been so long. Cheers mc On 27 Jul 2006 at 9:46, Detlef Schulze wrote: > If you only want to stream a file to the browser the example in the faq > is perfectly ok. > > If you want to do something else, for example create an image from a > database blob or whatever for displaying it in a page, you should create > your own engine service for that. > > IIRC there is an example for that (ChartService) in the demo application > that you can download (workbench or virtual library) at least that was > the case with tap 3. > > Cheers, > detlef > > -----Original Message----- > From: Murray Collingwood [mailto:[EMAIL PROTECTED] > Sent: Donnerstag, 27. Juli 2006 09:49 > To: tapestry users > Subject: Streaming files from Tapestry > > Hi all > > This faq page http://tapestry.apache.org/tapestry4/faq.html answers a > common question > people have about how to serve images or other binary files from a > Tapestry application. > The details are provided under: > > 2.6. How do I stream a file to the user from Tapestry? > > The example that follows works for a 'Document' type which is fine, > however the 'disowner' at > the bottom of the answer indicates that this is not the way this should > be done. Also, recently > in the forum when somebody tried this they found it only worked if you > were sending this > document as the only result (not as an image or other object type in the > midst of a page). > > So, can somebody please document the answer to this question how it > should be done? And > of course - update the faq. > > Cheers > mc > > > > FOCUS Computing - web design > Mob: 0415 24 26 24 > [EMAIL PROTECTED] > http://www.focus-computing.com.au > > > > > -- > No virus found in this outgoing message. > Checked by AVG Free Edition. > Version: 7.1.394 / Virus Database: 268.10.4/401 - Release Date: > 26/07/2006 > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > FOCUS Computing - web design Mob: 0415 24 26 24 [EMAIL PROTECTED] http://www.focus-computing.com.au -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.394 / Virus Database: 268.10.4/401 - Release Date: 26/07/2006 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]