Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

Excel spreadsheet and cache duration

$
0
0
We have an ajax button that submits a form that, if the parameters are right,
will download an excel file. The developers who wrote the page used an ajax
behavior and then write the request out as javascript like so:

target.appendJavaScript((CharSequence) ("window.location.href='" +
getCallbackUrl() + "';"));

After building the byte array resource and sticking it in place via:

getComponent().getRequestCycle().scheduleRequestHandlerAfterCurrent(new
ResourceRequestHandler(rptRS, null));

The problem with this is that when a person changes the parameters and
resubmits the form to get a different dynamically generated excel, there's
some caching in play and they get the same one they downloaded earlier.

We put getResourceSettings().setDefaultCacheDuration(Duration.NONE); in the
application init and it seemed to solve it. But setting to no cache for the
whole app seems like overkill. We'd like to set it for this one download.
I've seen forum posts that suggest there is a setCacheDuration on some
specific objects, but none of the ones I seem to try.

How would I set the cache to none for THIS object/URL?

Viewing all articles
Browse latest Browse all 5648

Trending Articles