|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
ByteArrayResource's getCacheDuration( )Hi,
I want to be able to generate the byteArray (for MS - Excel report being passed to a byteArrayResource every time the resource link is clicked. I was trying to use getCacheDuration( ) for the same to allow for it to create ByteArray every time the resource link is clicked on the page. I have something like : final ByteArrayResource modelReportByteArrayResource = new ByteArrayResource(CONTENT_TYPE, createByteArray() ,FILE_NAME) { // java docs removed for clarity protected final int getCacheDuration() { return -1; // -1 or 0 doesn't work. =( } }; // add the resource. add(new ResourceLink(modelReportResource )); I tried to override : // java docs removed for clarity protected final void setHeaders(final WebResponse response) { response.setHeader("Cache-Control", "no-cache, must-revalidate"); } But I still get the same excel report over and over no matter how many times i click the link, despite me changing some data or the stream. Any suggestions / thoughts??? Regards Vyas, Anirudh |
|
|
Re: ByteArrayResource's getCacheDuration( )Hello,
reading the docs of ByteArrayResource I do not think it is dynamic. The generated resource is in memory. greetings
|
|
|
Re: ByteArrayResource's getCacheDuration( )Hi,
My apologies I did not follow up on this. I On Sun, Jul 13, 2008 at 1:29 PM, greeklinux <marsias@...> wrote: > > Hello, > > reading the docs of ByteArrayResource I do not think it is dynamic. > The generated resource is in memory. > > greetings > > > > Ricky-22 wrote: > > > > Hi, > > > > I want to be able to generate the byteArray (for MS - Excel report being > > passed to a byteArrayResource every time the resource link is clicked. I > > was > > trying to use getCacheDuration( ) for the same to allow for it to create > > ByteArray every time the resource link is clicked on the page. > > > > I have something like : > > > > final ByteArrayResource modelReportByteArrayResource = new > > ByteArrayResource(CONTENT_TYPE, createByteArray() ,FILE_NAME) { > > > > // java docs removed for clarity > > protected final int getCacheDuration() { > > return -1; // -1 or 0 doesn't work. =( > > } > > }; > > > > // add the resource. > > add(new ResourceLink(modelReportResource )); > > > > I tried to override : > > // java docs removed for clarity > > protected final void setHeaders(final WebResponse response) { > > response.setHeader("Cache-Control", "no-cache, > > must-revalidate"); > > } > > > > But I still get the same excel report over and over no matter how many > > times > > i click the link, despite me changing some data or the stream. > > > > Any suggestions / thoughts??? > > > > Regards > > Vyas, Anirudh > > > > > > -- > View this message in context: > http://www.nabble.com/ByteArrayResource%27s-getCacheDuration%28-%29-tp18406048p18431593.html > Sent from the Wicket - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@... > For additional commands, e-mail: users-help@... > > -- Regards Vyas, Anirudh || ॐ || |
|
|
Re: ByteArrayResource's getCacheDuration( )err sorry for half reply, I didnt follow up on this, my apologies. I used a
WebResource and am setting setIsCacheable(false) and also overriding getResourceStream method of the same to return a custom IResourceStream instance. In IResourceStream i override, the getInputStream method to chain ByteArrayOutputStream to get my data dynamically. I'll post the code tommorrow, when i get to office. Regards Vyas, Anirudh On Tue, Jul 15, 2008 at 8:25 PM, Ricky <ricky.nj@...> wrote: > Hi, > > My apologies I did not follow up on this. I > > > On Sun, Jul 13, 2008 at 1:29 PM, greeklinux <marsias@...> wrote: > >> >> Hello, >> >> reading the docs of ByteArrayResource I do not think it is dynamic. >> The generated resource is in memory. >> >> greetings >> >> >> >> Ricky-22 wrote: >> > >> > Hi, >> > >> > I want to be able to generate the byteArray (for MS - Excel report being >> > passed to a byteArrayResource every time the resource link is clicked. I >> > was >> > trying to use getCacheDuration( ) for the same to allow for it to create >> > ByteArray every time the resource link is clicked on the page. >> > >> > I have something like : >> > >> > final ByteArrayResource modelReportByteArrayResource = new >> > ByteArrayResource(CONTENT_TYPE, createByteArray() ,FILE_NAME) { >> > >> > // java docs removed for clarity >> > protected final int getCacheDuration() { >> > return -1; // -1 or 0 doesn't work. =( >> > } >> > }; >> > >> > // add the resource. >> > add(new ResourceLink(modelReportResource )); >> > >> > I tried to override : >> > // java docs removed for clarity >> > protected final void setHeaders(final WebResponse response) >> { >> > response.setHeader("Cache-Control", "no-cache, >> > must-revalidate"); >> > } >> > >> > But I still get the same excel report over and over no matter how many >> > times >> > i click the link, despite me changing some data or the stream. >> > >> > Any suggestions / thoughts??? >> > >> > Regards >> > Vyas, Anirudh >> > >> > >> >> -- >> View this message in context: >> http://www.nabble.com/ByteArrayResource%27s-getCacheDuration%28-%29-tp18406048p18431593.html >> Sent from the Wicket - User mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscribe@... >> For additional commands, e-mail: users-help@... >> >> > > > -- > > Regards > Vyas, Anirudh > || ॐ || > |
| Free Forum Powered by Nabble | Forum Help |