Wicket
  1. Wicket
  2. WICKET-4131

Add a non-caching RenderedDynamicImageResource

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Later
    • Affects Version/s: 1.5.2
    • Fix Version/s: None
    • Component/s: wicket
    • Labels:
      None

      Description

      RenderedDynamicImageResource ignores all cache settings and keeps its image data once it has been rendered. This is not very useful for tasks like rendering statistics which will be reloaded often but with identical parameters, yet still need to show updated charts.

      Ideally, RenderedDynamicImageResource's getImageData() method should check these cache settings, however, they are not available at that point – please correct me if I'm wrong here.

      Another option would be to simply change getImageData()'s behavior to not cache anything. That might break existing code though, so I think we shouldn't do that right now.

      As a fallback I propose adding a NonCachingRenderedDynamicImageResource that prevents caching. This can then be used as a drop-in replacement for the regular RDIR whenever caching should be avoided.

        Activity

        Carl-Eric Menzel created issue -
        Hide
        Carl-Eric Menzel added a comment -

        This patch adds the proposed NonCachingRenderedDynamicImageResource.

        Show
        Carl-Eric Menzel added a comment - This patch adds the proposed NonCachingRenderedDynamicImageResource.
        Carl-Eric Menzel made changes -
        Field Original Value New Value
        Attachment 0001-WICKET-4131-Add-NonCachingRenderedDynamicImageResour.patch [ 12499017 ]
        Hide
        Martin Grigorov added a comment -

        I believe this is the purpose of org.apache.wicket.markup.html.image.resource.RenderedDynamicImageResource.invalidate().
        If you want to render something new you should call this method in addition to #disableCaching().

        Show
        Martin Grigorov added a comment - I believe this is the purpose of org.apache.wicket.markup.html.image.resource.RenderedDynamicImageResource.invalidate(). If you want to render something new you should call this method in addition to #disableCaching().
        Hide
        Martin Grigorov added a comment -

        Carl-Eric can you comment on #invalidate(). Does it solve the problem for you ?

        Show
        Martin Grigorov added a comment - Carl-Eric can you comment on #invalidate(). Does it solve the problem for you ?
        Hide
        Carl-Eric Menzel added a comment -

        Sorry for the late reply.

        #invalidate comes close, but doesn't quite fix it. With #invalidate() I have to call that every time I need to render something new, and I have to call that from outside the resource. We're rendering live statistical data, and so the image should be fresh on each reload. I can't call #invalidate() from within #render() though.

        I think #invalidate() and NonCachingRDIR would serve two different purposes. #invalidate() is for images that can change but the change is far enough in the future that caching is worthwhile. NCRDIR (that name may be too long ) on the other hand is for situations when caching makes no sense at all and I always want a fresh image to be drawn.

        So I propose keeping invalidate, adding NCRDIR and improving the documentation to mention invalidate and NCRDIR in the javadoc of RDIR and RDIR#render.

        Show
        Carl-Eric Menzel added a comment - Sorry for the late reply. #invalidate comes close, but doesn't quite fix it. With #invalidate() I have to call that every time I need to render something new, and I have to call that from outside the resource. We're rendering live statistical data, and so the image should be fresh on each reload. I can't call #invalidate() from within #render() though. I think #invalidate() and NonCachingRDIR would serve two different purposes. #invalidate() is for images that can change but the change is far enough in the future that caching is worthwhile. NCRDIR (that name may be too long ) on the other hand is for situations when caching makes no sense at all and I always want a fresh image to be drawn. So I propose keeping invalidate, adding NCRDIR and improving the documentation to mention invalidate and NCRDIR in the javadoc of RDIR and RDIR#render.
        Hide
        Martin Grigorov added a comment -

        It seems there was no interest in this new resource type for 2 years now.
        If you think it is still needed/useful then reopen the ticket and apply your patch.

        Show
        Martin Grigorov added a comment - It seems there was no interest in this new resource type for 2 years now. If you think it is still needed/useful then reopen the ticket and apply your patch.
        Martin Grigorov made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Later [ 7 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Carl-Eric Menzel
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development