Re: Streaming files from Tapestry
Hi! I decided to reply to this old thread, I didn't find any newer ones on this subject. I miss a "vanilla service" that reads a file from the server and streams it to the client. This is a very natural part of a web project, and it's hard for me to understand why there isn't a simple extendible default for this built into the newer version of Tapestry. Does anyone have a simple code sample with java and configuration for a file download service available? Thanks Inge On Mon, Jul 31, 2006 at 10:20 AM, Peter Svensson <[EMAIL PROTECTED]> wrote: > I agree with Murray that Tapestry should provide a vanilla service for > downloading files such as images. It one of the first things you want to do > as a newbie and the learning curve is unnecessary steep, especially at that > early point. > > I would not be surprised if that's the place where many newbies give up and > become .net n00bs instead. > > It would cost so little to put it in, preferrably with an easy to grok > callback for dynamic stuff. > > It would make people more happy, kick less newbies in the shins and > generally ease the natural process of Tapestry world dominance. Wadda ya > say? :) > > Cheers, > PS > > > On 7/30/06, Murray Collingwood <[EMAIL PROTECTED]> wrote: > >> >> Hi Ezra >> >> You asked: >> >> > I don't see how it relates to Tapestry. >> >> It relates to Tapestry because it appears on your faq. >> >> Option: >> >> a) Remove it from the faq (pretend people are asking this question, or >> that they are only >> misguided fools like myself) >> >> b) Fix the faq by providing a recommended solution. >> >> This of course was my original posting I'll stop going around in >> circles now that I hope >> everybody understands the issue. >> >> 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.5/403 - Release Date: 28/07/2006 >> >> >> - >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >>
Re: Streaming files from Tapestry
I agree with Murray that Tapestry should provide a vanilla service for downloading files such as images. It one of the first things you want to do as a newbie and the learning curve is unnecessary steep, especially at that early point. I would not be surprised if that's the place where many newbies give up and become .net n00bs instead. It would cost so little to put it in, preferrably with an easy to grok callback for dynamic stuff. It would make people more happy, kick less newbies in the shins and generally ease the natural process of Tapestry world dominance. Wadda ya say? :) Cheers, PS On 7/30/06, Murray Collingwood <[EMAIL PROTECTED]> wrote: Hi Ezra You asked: > I don't see how it relates to Tapestry. It relates to Tapestry because it appears on your faq. Option: a) Remove it from the faq (pretend people are asking this question, or that they are only misguided fools like myself) b) Fix the faq by providing a recommended solution. This of course was my original posting I'll stop going around in circles now that I hope everybody understands the issue. 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.5/403 - Release Date: 28/07/2006 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Streaming files from Tapestry
Hi Ezra You asked: > I don't see how it relates to Tapestry. It relates to Tapestry because it appears on your faq. Option: a) Remove it from the faq (pretend people are asking this question, or that they are only misguided fools like myself) b) Fix the faq by providing a recommended solution. This of course was my original posting I'll stop going around in circles now that I hope everybody understands the issue. 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.5/403 - Release Date: 28/07/2006 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Streaming files from Tapestry
If the content is available from another servlet context then hasn't this added (only) more obscurity rather than security? It seems for the security the servlet must do the authorization check before serving hence, again, I don't see how it relates to Tapestry. Thanks, Ezra Epstein -Original Message- From: Murray Collingwood [mailto:[EMAIL PROTECTED] Sent: Friday, July 28, 2006 2:14 PM To: Tapestry users Subject: RE: Streaming files from Tapestry Hi Ezra I did look at doing this as a work around, however it has one major flaw - it doesn't provide any security. In a CRM system, for example, if the document download link is http://webserver/MyOtherWebContext/images/01.doc then it's not going to take somebody long to realise they can type in other numbers and retrieve documents that they may not have access to. With a servlet running inside my application I can check the users security immediately before I stream the document. The other benefit of keeping the servlet as part of my application is that I can store the external directory name in one location rather than two. A small benefit. My final argument is that the faq should be providing the recommended solution. Obviously lots of people have already asked for this (that's why it's in a faq) so I'm not alone out here... I have written a small servlet to do what I want. It has limited functionality but it serves my immediate purpose. I am still hopeful that somebody will deliver a servlet or library that does serve this purpose in a better and generic method, I am happy to be the first to test and implement it. Cheers mc On 28 Jul 2006 at 9:53, Epstein, Ezra wrote: > 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: > > > > 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: > > src="/MyTapestryAppName/js/myJavaScriptFile.js"> > > Works great. > > Perhaps I misread the question. > > Thanks, > > Ezra Epstein > > -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.394 / Virus Database: 268.10.4/402 - Release Date: 27/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]
RE: Streaming files from Tapestry
Hi Ezra I did look at doing this as a work around, however it has one major flaw - it doesn't provide any security. In a CRM system, for example, if the document download link is http://webserver/MyOtherWebContext/images/01.doc then it's not going to take somebody long to realise they can type in other numbers and retrieve documents that they may not have access to. With a servlet running inside my application I can check the users security immediately before I stream the document. The other benefit of keeping the servlet as part of my application is that I can store the external directory name in one location rather than two. A small benefit. My final argument is that the faq should be providing the recommended solution. Obviously lots of people have already asked for this (that's why it's in a faq) so I'm not alone out here... I have written a small servlet to do what I want. It has limited functionality but it serves my immediate purpose. I am still hopeful that somebody will deliver a servlet or library that does serve this purpose in a better and generic method, I am happy to be the first to test and implement it. Cheers mc On 28 Jul 2006 at 9:53, Epstein, Ezra wrote: > 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: > > > > 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: > > src="/MyTapestryAppName/js/myJavaScriptFile.js"> > > Works great. > > Perhaps I misread the question. > > Thanks, > > Ezra Epstein > > -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.394 / Virus Database: 268.10.4/402 - Release Date: 27/07/2006 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Streaming files from Tapestry
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: 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: 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: servesBinaryFiles org.somebody.SimpleBinaryServlet 0 binaryPath /home/application/storage servesBinaryFiles /extimage/* 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 comm
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: servesBinaryFiles org.somebody.SimpleBinaryServlet 0 binaryPath /home/application/storage servesBinaryFiles /extimage/* 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.apac
RE: Streaming files from Tapestry
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]