i you just need to do
rdir.setCacheable(false)

you could configure the response for the Resource but i don;t think that is needed when a resource is not cacheable.


On 10/24/05, Joshua Lim <[EMAIL PROTECTED]> wrote:
Hi
I am trying to understand dynamic images using wicket 1.1 rc 2.

basically i have 2 pages. A login page and a voucher page. - similar to the login example in eicket example.

Here's the problem. after loggin in, I present a voucher  based on the next page. this voucher is created using
RenderedDynamicImageResource

        rdir = new RenderedDynamicImageResource(WIDTH, HEIGHT)
        {
            protected boolean render(Graphics2D graphics)
            {
                drawVoucher(graphics, user);
                return true;
            }
        };

where drawVoucher will dynamically read an image and add the user details on the voucher making it personalised.
(could have super imposed using Labels but ... went down this track instead...hindsight...)

upon loggin in, I get the voucher ok. for the first time. subsequent log ins using a different user on a
fresh browser causes the previous user's info to appear....So I thought it was cached and hit the refresh button
and true enough, the voucher got updated with the right info.

so I tried ...

    protected void configureResponse() {
        System.out.println("Configure Response");
        super.configureResponse();
        WebRequestCycle wrc = getWebRequestCycle();
        WebResponse wrp = ((WebResponse)getWebRequestCycle().getOriginalResponse());
        wrp.setHeader("Cache-Control","no-cache"); //HTTP 1.1
        wrp.setHeader("Pragma","no-cache"); //HTTP 1.0
        wrp.setDateHeader ("Expires", 0);
    }

but it does not seems to force a refresh on the client browser upon the 2nd login.


so I also tried

    protected void onBeginRequest() {
      rdir.invalidate();
    }

and also does not work...


Am I doing somthing wrong here ?

Joshua






Reply via email to