um.. actually it is not really a filename, but is more like an ID of a file.. is a unique string generated by the server (is the original filename user uploaded).
I came up with this solution using your CleanupRender suggestion which will completely hide the filename (or ID of the file): ... @Persist("flash") private String imageFilename; @Persist("flash") private String tmpImageFilename; @CleanupRender public void onCleanupRender() { //to hand over the filename... tmpImageFilename = imageFilename; } And then I will call "tmpImageFilename" instead to get the variable.. looks kind of "not clean" to me using this approach.. Is that what you mean by resetting the imageFilename? If I have more than one of those image links, does that mean I will have more @Persist("flash") tmp variables?? In other words, is the number of action links equal to the number of the page being re-render (go thru the whole cycle again)? I wonder if there is other "side-effects" using this approach.. thx again! Ronald Josh Canfield-2 wrote: > > Yikes, that sounds dangerous... am I going to be able to load random files > from your server by tweaking that filename? > > > On 10/26/07, ronaldlee <[EMAIL PROTECTED]> wrote: >> >> >> Thanks for the tip. >> >> I find a solution to this problem by simply passing the filename as the >> link's param, like this: >> >> public Link getSmallThumbnailImageURL(){ >> return resources.createActionLink("imageFileURL", false, >> new >> Object[]{getImageFilename()}); >> } >> >> public StreamResponse onImageFileURL(String imageFilename) { >> .... >> >> thx! >> >> Ronald >> >> >> Josh Canfield-2 wrote: >> > >> > The @Persist("flash") removes the object after page B is processed the >> > first >> > time, then when you call the action handler page B is processed again >> and >> > your field is null, as it should be. >> > >> > You should be able to simply add a cleanupRender method to page B which >> > resets the flash persisted field. I believe that when the action event >> is >> > triggered by the img it will get access the persisted field which nulls >> > the >> > field, and won't trigger the cleanupRender thus allowing the field to >> stay >> > null. >> > >> > I haven't written the code, but I'm fairly sure that it should work and >> > it's >> > not much work to test it out. >> > >> > Good luck, >> > Josh >> > >> > >> > On 10/26/07, ronaldlee <[EMAIL PROTECTED]> wrote: >> >> >> >> >> >> Hi, >> >> >> >> I am having problem with @Persist(Flash) and StreamResponse.. I am >> using >> >> the >> >> latest 5.0.6 release. >> >> Here is my setup: >> >> - I have two pages, page A is for uploading an image, and page B is >> for >> >> previewing an image. >> >> - Page A injects Page B, and Page B has a @Persist("flash") on a >> >> "imageFilename" attribute. >> >> - Page A's onSuccess method is called when an image file is uploaded >> >> (using >> >> tapestry-upload), then it will call Page B's setImageFilename method >> to >> >> pass >> >> on the filename being uploaded, then Page B is returned. >> >> - Page B will use the StreamResponse approach to return the image file >> >> (because the image file is stored in a location not directly >> accessible >> >> from >> >> Internet), following the tapestry howto's instruction >> >> >> (http://wiki.apache.org/tapestry/Tapestry5HowToCreatePieChartsInAPage). >> >> Page >> >> B injects a ComponentResource for creating an action link, which in >> >> return >> >> will be inserted in the template.. see the howto's for more detail. >> >> >> >> And here is the problem, inside that "StreamResponse onImageFileURL()" >> >> function, the "imageFilename" attribute is null (and as a result I >> cannot >> >> read that file of course), but on Page B's template I am able to >> display >> >> the >> >> value ${imageFilename}. There may have something to do which come >> first >> >> (the >> >> onImageFileURL is called first before the imageFilename is set?). >> >> >> >> Is it an issue and is there any workaround? Or just I am doing it the >> >> wrong >> >> way? >> >> >> >> thx! >> >> Ronald >> >> >> >> -- >> >> View this message in context: >> >> >> http://www.nabble.com/T-5--%40Persist%28%22Flash%22%29-and-StreamResponse-tf4700054.html#a13436353 >> >> Sent from the Tapestry - User mailing list archive at Nabble.com. >> >> >> >> >> >> --------------------------------------------------------------------- >> >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> >> >> > >> > >> > -- >> > -- >> > TheDailyTube.com. Sign up and get the best new videos on the internet >> > delivered fresh to your inbox. >> > >> > >> >> -- >> View this message in context: >> http://www.nabble.com/T-5--%40Persist%28%22Flash%22%29-and-StreamResponse-tf4700054.html#a13437036 >> Sent from the Tapestry - User mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > > -- > -- > TheDailyTube.com. Sign up and get the best new videos on the internet > delivered fresh to your inbox. > > -- View this message in context: http://www.nabble.com/T-5--%40Persist%28%22Flash%22%29-and-StreamResponse-tf4700054.html#a13437902 Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]