Great, exactly what i had in mind :) Thanks.
On Tue, Nov 23, 2010 at 4:42 PM, Martin Grigorov-4 [via Apache Wicket] < ml-node+3056108-1056044911-65...@n4.nabble.com<ml-node%2b3056108-1056044911-65...@n4.nabble.com> > wrote: > Covered by the fix ;-) > All classes > extending org.apache.wicket.util.resource.AbstractStringResourceStream will > > have it initialized for free. > > On Tue, Nov 23, 2010 at 8:37 PM, jcgarciam <[hidden > email]<http://user/SendEmail.jtp?type=node&node=3056108&i=0>> > wrote: > > > > > Hi Martin, > > > > I explored the object hierarchy, and it seems *StringBufferResourceStream > > > *may > > suffer from the same problem, if its constructed and no append or prepend > > > method is called on it (which is a weird scenario of course). > > > > Thanks! > > > > On Tue, Nov 23, 2010 at 4:27 PM, Martin Grigorov-4 [via Apache Wicket] < > > [hidden email] > > <http://user/SendEmail.jtp?type=node&node=3056108&i=1><[hidden > email] <http://user/SendEmail.jtp?type=node&node=3056108&i=2>> > > <[hidden email] > > <http://user/SendEmail.jtp?type=node&node=3056108&i=3><[hidden > email] <http://user/SendEmail.jtp?type=node&node=3056108&i=4>> > > > > > > wrote: > > > > > Done. > > > r1038292 > > > > > > On Tue, Nov 23, 2010 at 8:20 PM, Martin Grigorov <[hidden email]< > > http://user/SendEmail.jtp?type=node&node=3056080&i=0>>wrote: > > > > > > > > > > Looks like a bug. > > > > I think StringResourceStream has to initialize its lastModifiedTime > in > > > the > > > > constructor to Time.now(). > > > > > > > > I'll create a ticket and fix it. > > > > > > > > > > > > On Tue, Nov 23, 2010 at 8:05 PM, jcgarciam <[hidden email]< > > http://user/SendEmail.jtp?type=node&node=3056080&i=1>> > > > wrote: > > > > > > > >> > > > >> Hi Folks, > > > >> > > > >> Probably im doing it wrong, but please bear with me, currently i'm > > > trying > > > >> to > > > >> do a very simple download operation in wicket 1.5M3, but it fails > with > > a > > > > > > >> NPE > > > >> in (ResourceStreamResource.java line 72), because it seems is always > > > > >> expecting that any IResourceStream implementation set the > > > lastModifiedTime > > > >> in the underlying stream before calling dataNeedsToBeWritten which > > > >> StringResourceStream doesn't do it ( i need to explicitly set it to > > make > > > > > > >> it > > > >> work ) . > > > >> > > > >> @Override > > > >> protected ResourceResponse newResourceResponse(Attributes > > > >> attributes) > > > >> { > > > >> ResourceResponse data = new ResourceResponse(); > > > >> (72)-> data.setLastModified(stream.lastModifiedTime().toDate()); > > > >> > > > >> > > > >> My code using [StringResourceStream] > > > >> <code> > > > >> final StringBuilder content = new > StringBuilder("Hello,world"); > > > >> add(new Link<Void>("downloadDoc") { > > > >> @Override > > > >> public void onClick() { > > > >> StringResourceStream stream = new > > > >> StringResourceStream(content.toString(),"html/csv"); > > > >> > > > >> getRequestCycle().scheduleRequestHandlerAfterCurrent(new > > > >> ResourceStreamRequestHandler(stream) > > > >> .setFileName("demo.csv") > > > >> > > > >> .setContentDisposition(ContentDisposition.ATTACHMENT)); > > > >> } > > > >> }); > > > >> </code> > > > >> > > > >> Calling [stream.setLastModified(Time.now());] right before > scheduling > > > the > > > >> request handler make the download to works, but it seems that > probably > > > im > > > >> doing something wrong (not supposed to a download on this way) or > does > > > it > > > >> sounds like a bug in [ResourceStreamResource.java]? > > > >> > > > >> Thanks, > > > >> > > > >> Attached is a quickstart > > > >> > > > >> > > > > > > http://apache-wicket.1842946.n4.nabble.com/file/n3056036/DownloadStreamBug.7z<http://apache-wicket.1842946.n4.nabble.com/file/n3056036/DownloadStreamBug.7z?by-user=t> > > < > > > http://apache-wicket.1842946.n4.nabble.com/file/n3056036/DownloadStreamBug.7z?by-user=t<http://apache-wicket.1842946.n4.nabble.com/file/n3056036/DownloadStreamBug.7z?by-user=t&by-user=t> > > > > > > > >> DownloadStreamBug.7z > > > >> > > > >> > > > >> -- > > > >> View this message in context: > > > >> > > > > > > http://apache-wicket.1842946.n4.nabble.com/Simple-Download-from-StringResourceStream-cause-NPE-wicket-1-5M3-possible-bug-tp3056036p3056036.html<http://apache-wicket.1842946.n4.nabble.com/Simple-Download-from-StringResourceStream-cause-NPE-wicket-1-5M3-possible-bug-tp3056036p3056036.html?by-user=t> > > < > > > http://apache-wicket.1842946.n4.nabble.com/Simple-Download-from-StringResourceStream-cause-NPE-wicket-1-5M3-possible-bug-tp3056036p3056036.html?by-user=t<http://apache-wicket.1842946.n4.nabble.com/Simple-Download-from-StringResourceStream-cause-NPE-wicket-1-5M3-possible-bug-tp3056036p3056036.html?by-user=t&by-user=t> > > > > > > > >> Sent from the Users forum mailing list archive at Nabble.com. > > > >> > > > >> > --------------------------------------------------------------------- > > > >> To unsubscribe, e-mail: [hidden email]< > > http://user/SendEmail.jtp?type=node&node=3056080&i=2> > > > >> For additional commands, e-mail: [hidden email]< > > http://user/SendEmail.jtp?type=node&node=3056080&i=3> > > > >> > > > >> > > > > > > > > > > > > > ------------------------------ > > > View message @ > > > > > > http://apache-wicket.1842946.n4.nabble.com/Simple-Download-from-StringResourceStream-cause-NPE-wicket-1-5M3-possible-bug-tp3056036p3056080.html<http://apache-wicket.1842946.n4.nabble.com/Simple-Download-from-StringResourceStream-cause-NPE-wicket-1-5M3-possible-bug-tp3056036p3056080.html?by-user=t> > > > > > > To unsubscribe from Simple Download from StringResourceStream cause NPE > > > > wicket 1.5M3 (possible bug??), click here< > > > http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3056036&code=amNnYXJjaWFtQGdtYWlsLmNvbXwzMDU2MDM2fDEyNTYxMzc3ODY=<http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3056036&code=amNnYXJjaWFtQGdtYWlsLmNvbXwzMDU2MDM2fDEyNTYxMzc3ODY=&by-user=t> > > >. > > > > > > > > > > > > > > -- > > Sincerely, > > JC (http://www.linkedin.com/in/jcgarciam) > > Work smarter, not harder!. > > > > -- > > View this message in context: > > > http://apache-wicket.1842946.n4.nabble.com/Simple-Download-from-StringResourceStream-cause-NPE-wicket-1-5M3-possible-bug-tp3056036p3056096.html<http://apache-wicket.1842946.n4.nabble.com/Simple-Download-from-StringResourceStream-cause-NPE-wicket-1-5M3-possible-bug-tp3056036p3056096.html?by-user=t> > > > Sent from the Users forum mailing list archive at Nabble.com. > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [hidden > > email]<http://user/SendEmail.jtp?type=node&node=3056108&i=5> > > For additional commands, e-mail: [hidden > > email]<http://user/SendEmail.jtp?type=node&node=3056108&i=6> > > > > > > > ------------------------------ > View message @ > http://apache-wicket.1842946.n4.nabble.com/Simple-Download-from-StringResourceStream-cause-NPE-wicket-1-5M3-possible-bug-tp3056036p3056108.html > > To unsubscribe from Simple Download from StringResourceStream cause NPE > wicket 1.5M3 (possible bug??), click > here<http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3056036&code=amNnYXJjaWFtQGdtYWlsLmNvbXwzMDU2MDM2fDEyNTYxMzc3ODY=>. > > -- Sincerely, JC (http://www.linkedin.com/in/jcgarciam) Work smarter, not harder!. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Simple-Download-from-StringResourceStream-cause-NPE-wicket-1-5M3-possible-bug-tp3056036p3056116.html Sent from the Users forum mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org