You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Todd Nine <to...@spidertracks.com> on 2011/07/12 02:52:06 UTC
Help with path mounting and static asset expiration
Hi guys,
We've just finished our first wicket app using wicket 1.4.17.
Everything works well, but we get a lot of resource requests for resource
that rarely change. I've read a few blogs on the subject, and this one is
the closest to what I want to do, however it's not quite right.
http://techblog.molindo.at/2008/08/wicket-interface-speed-up-caching-resources-forever.html
This explicitly calls the code to wrap the resource, I don't want our
developers to have to do this. We have several templates that use wicket's
autolinking feature, so I would like them to be able to use it as well.
Here's what I currently have.
A Custom resource loader that is simply a wrapper and delegates to
WebApplicationPath for resource loading.
Once the resource is loaded, if it ends in .js, .css, or .png an SHA sum is
calculated on the file contents. I then want to create a mount path in
the format of <original file>_sha256.<original extension>
I also then need to wrap the created resource with an expiration time of now
+ 1 month. This way, our images can be cached completely on the client. In
the event the file changes, the sha256 sum will change, and hence so will
the file name's url, forcing the client to re-download the new content.
Any thoughts on how I can do this? I'd prefer to only do it once the first
time the resource is loaded, but I can only seem to override the
ResourceFinder using the above logic, which does not give me access to the
created ResourceReference itself with wicket expiration and other
properties.
I thought about using a listener, but this requires the mapping to happen
with each request, which seems very inefficient since it will only change at
deploy time.
Any help would be greatly appreciated, I'm at a bit of a loss on this one.
Thanks,
Todd
Re: Help with path mounting and static asset expiration
Posted by Todd Nine <to...@spidertracks.com>.
Hi Martin,
I noticed that in the changelog, and the timestamp appended to the file
name.
Unfortunately we have a lot of custom work based on the 1.4 code base, and
use quite a few plugins. Upgrading to 1.5 will be at least a month to all
our code and the plugins (I scoped it out today). We'll do it eventually,
but not until 1.5 becomes a full release. Our application requires that we
that cannot have any downtime, and I'm a bit leery to use it until it's been
deemed stable since the 1.4 stable code base has been rock solid for our
needs.
Thanks,
Todd
On 12 July 2011 18:12, Martin Grigorov <mg...@apache.org> wrote:
> Consider upgrading to Wicket 1.5. There are a lot of improvements
> about that - see
> org.apache.wicket.request.resource.caching.IResourceCachingStrategy.
>
>
> On Tue, Jul 12, 2011 at 2:52 AM, Todd Nine <to...@spidertracks.com> wrote:
> > Hi guys,
> > We've just finished our first wicket app using wicket 1.4.17.
> >
> > Everything works well, but we get a lot of resource requests for resource
> > that rarely change. I've read a few blogs on the subject, and this one
> is
> > the closest to what I want to do, however it's not quite right.
> >
> >
> >
> http://techblog.molindo.at/2008/08/wicket-interface-speed-up-caching-resources-forever.html
> >
> >
> > This explicitly calls the code to wrap the resource, I don't want our
> > developers to have to do this. We have several templates that use
> wicket's
> > autolinking feature, so I would like them to be able to use it as well.
> >
> >
> > Here's what I currently have.
> >
> >
> > A Custom resource loader that is simply a wrapper and delegates to
> > WebApplicationPath for resource loading.
> >
> > Once the resource is loaded, if it ends in .js, .css, or .png an SHA sum
> is
> > calculated on the file contents. I then want to create a mount path in
> > the format of <original file>_sha256.<original extension>
> >
> >
> > I also then need to wrap the created resource with an expiration time of
> now
> > + 1 month. This way, our images can be cached completely on the client.
> In
> > the event the file changes, the sha256 sum will change, and hence so will
> > the file name's url, forcing the client to re-download the new content.
> >
> > Any thoughts on how I can do this? I'd prefer to only do it once the
> first
> > time the resource is loaded, but I can only seem to override the
> > ResourceFinder using the above logic, which does not give me access to
> the
> > created ResourceReference itself with wicket expiration and other
> > properties.
> >
> > I thought about using a listener, but this requires the mapping to happen
> > with each request, which seems very inefficient since it will only change
> at
> > deploy time.
> >
> > Any help would be greatly appreciated, I'm at a bit of a loss on this
> one.
> >
> > Thanks,
> > Todd
> >
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: Help with path mounting and static asset expiration
Posted by Martin Grigorov <mg...@apache.org>.
Consider upgrading to Wicket 1.5. There are a lot of improvements
about that - see
org.apache.wicket.request.resource.caching.IResourceCachingStrategy.
On Tue, Jul 12, 2011 at 2:52 AM, Todd Nine <to...@spidertracks.com> wrote:
> Hi guys,
> We've just finished our first wicket app using wicket 1.4.17.
>
> Everything works well, but we get a lot of resource requests for resource
> that rarely change. I've read a few blogs on the subject, and this one is
> the closest to what I want to do, however it's not quite right.
>
>
> http://techblog.molindo.at/2008/08/wicket-interface-speed-up-caching-resources-forever.html
>
>
> This explicitly calls the code to wrap the resource, I don't want our
> developers to have to do this. We have several templates that use wicket's
> autolinking feature, so I would like them to be able to use it as well.
>
>
> Here's what I currently have.
>
>
> A Custom resource loader that is simply a wrapper and delegates to
> WebApplicationPath for resource loading.
>
> Once the resource is loaded, if it ends in .js, .css, or .png an SHA sum is
> calculated on the file contents. I then want to create a mount path in
> the format of <original file>_sha256.<original extension>
>
>
> I also then need to wrap the created resource with an expiration time of now
> + 1 month. This way, our images can be cached completely on the client. In
> the event the file changes, the sha256 sum will change, and hence so will
> the file name's url, forcing the client to re-download the new content.
>
> Any thoughts on how I can do this? I'd prefer to only do it once the first
> time the resource is loaded, but I can only seem to override the
> ResourceFinder using the above logic, which does not give me access to the
> created ResourceReference itself with wicket expiration and other
> properties.
>
> I thought about using a listener, but this requires the mapping to happen
> with each request, which seems very inefficient since it will only change at
> deploy time.
>
> Any help would be greatly appreciated, I'm at a bit of a loss on this one.
>
> Thanks,
> Todd
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org