Hi,

If you don't use Wicket ResourceReference for the resource
(js/css/image/...) then Wicket will not do anything for it.
Still you have the following options:
- use a custom Servler Filter that adds the caching response headers for
any resource that does not have them. This filter should be configured
before WicketFilter in web.xml or annotations so that it wraps around it
- configure Jetty (or the frontend proxy if you use one (e.g. Apache HTTPD
or Nginx)) to set the missing headers

On Wed, Jun 26, 2019 at 10:24 PM Alan Stange <asta...@gmail.com> wrote:

> All,
>
> We've been using Wicket for some time now and are looking to improve the
> caching of javascript resources in our web app.   Explicit headers are
> being cached by the usual mechanism of calling
>  JavascriptHeaderItem.forReference().   The cases I'm having trouble with
> is when a javascript file is referencing another script, or a css file has
> a .png file in a url().
>
> Is there a way that I can say "All the static content in directory X (in
> the war file) and below is to be cached using the typical Wicket
> mechanisms"?
>
> As an example, pdf.js will require() pdf.worker.js, which is a 1.5MB file.
>   But I don't have control over the url being required.   How can I tell
> wicket to enable the caching headers for requests to file "pdf.worker.js"
> or "images/leftButton.png" with a 3600 second life.
>
> I've read through the docs and tried several options suggested and nothing
> seems to work.   I'm using Wicket 8.x under Jetty 9.4.19.
>
> Thank you,
>
> Alan
>

Reply via email to