1

To display a dynamically loaded image in my webapp I'm using a BufferedDynamicImageResource. (It just loads the image from a backend server based on an database id.)

The URL of the image resource ends up as:

http://localhost:8080/wicket/page?17-IResourceListener-logotype
                                  ^^
                            sequence number

where the sequence number increases for each such image I generate.

The problem is that the URL is reused from execution to execution (the sequence number is reset to 0) so when I restart the server the browser does not fetch the newly generated images, but instead uses the cached versions (which were generated last execution of the webapp).

My Question: What is the best way to avoid this behavior? (If I could for instance add the database id of the image which is loaded to the URL, everything would work fine.)

aioobe
  • 413,195
  • 112
  • 811
  • 826

1 Answers1

2

The most common way to solve this would be to mount the resource as seen here. Using this approach, you could use the id as a parameter or add an (ignored) random parameter to prevent caching completely.

Community
  • 1
  • 1
Nicktar
  • 5,548
  • 1
  • 28
  • 43
  • Thank you. Works great. I also found [this resource](http://web.archive.org/web/20120702095421/http://wicketinaction.com/2011/07/wicket-1-5-mounting-resources/comment-page-1/) which describes the same approach. – aioobe Jul 09 '13 at 19:40
  • This book is a pretty good resource for about everything wicket (not affieliated with the author in any way) – Nicktar Jul 09 '13 at 20:14