Wicket
  1. Wicket
  2. WICKET-4532

Disable caching for particular resources.

    Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.5.5, 6.0.0-beta1
    • Fix Version/s: 6.0.0-beta2
    • Component/s: wicket
    • Labels:
      None

      Description

      Currently it is possible to disable resources versioning by :
      getResourceSettings().setCachingStrategy(NoOpResourceCachingStrategy.INSTANCE);

      Unfortunately this disables caching for every resource, it would be nice to disable caching for particular (package) resource, something like:
      PackageResourceReference res = new PackageResourceReference(....);
      res.setCashable(false);

      Caching in general is good think but some javascript libraries get broken when filenames are modified with "ver..." token.

      Regards

        Activity

        Hide
        Peter Ertl added a comment - - edited

        there is now a new method

        boolean org.apache.wicket.request.resource.caching.IStaticCacheableResource#isCachingEnabled()

        which controls whether caching is applied or not.

        in case of PackageResourceReference (and friends) disabling caching could e.g.be achieved like this:

        PackageResourceReference reference = new PackageResourceReference(Home.class, "Beer.gif") {
        @Override
        public PackageResource getResource()

        { final PackageResource resource = super.getResource(); resource.setCachingEnabled(false); return resource; }

        };

        I will add this to the wiki later...

        Since the interface change breaks the api we can not offer this for 1.5.x but only for 6.x.

        Show
        Peter Ertl added a comment - - edited there is now a new method boolean org.apache.wicket.request.resource.caching.IStaticCacheableResource#isCachingEnabled() which controls whether caching is applied or not. in case of PackageResourceReference (and friends) disabling caching could e.g.be achieved like this: PackageResourceReference reference = new PackageResourceReference(Home.class, "Beer.gif") { @Override public PackageResource getResource() { final PackageResource resource = super.getResource(); resource.setCachingEnabled(false); return resource; } }; I will add this to the wiki later... Since the interface change breaks the api we can not offer this for 1.5.x but only for 6.x.
        Hide
        Martin Grigorov added a comment -

        It is OK to make API changes until we release 6.0.0-RC1.

        A comment about the patch itself: I think the covariant return in CssResourceReference#getResource() is a good thing.

        Can you also take a look at WICKET-4457?

        Show
        Martin Grigorov added a comment - It is OK to make API changes until we release 6.0.0-RC1. A comment about the patch itself: I think the covariant return in CssResourceReference#getResource() is a good thing. Can you also take a look at WICKET-4457 ?
        Hide
        Peter Ertl added a comment -

        I could fix this in 6.x (not in 1.5 since it will break the api) with the patch that is included in this issue. Can I get some feedback please if it's okay to commit it into master since we so close to 6.0.0 ?

        Show
        Peter Ertl added a comment - I could fix this in 6.x (not in 1.5 since it will break the api) with the patch that is included in this issue. Can I get some feedback please if it's okay to commit it into master since we so close to 6.0.0 ?

          People

          • Assignee:
            Peter Ertl
            Reporter:
            Daniel Lipski
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development