Igor Vaynberg wrote:
im not sure. if you set a no-cache header when you send the image then
the browser should always pull it down. if it doesnt work then you have
to customize the url with a random number. dont think Image tag supports
this. you can use a webmarkupcontainer and an attribute modifier to do
what you want. the attribute modifier will set the "src" element of the
webmarkupcontainer to something like this:
add( new AttributeModifier("src", true, new AbstractReadOnlyModel() {
Object getObject(Component c) { return
urlFor(my_image_resource)+"&rand="+Math.random(); } );
I tried it this way, by extending Image, but it still didn't work:
static class MyImage extends Image
{
public MyImage(String s, BufferedDynamicImageResource r) {
super(s,r);
}
protected void onComponentTag(ComponentTag componentTag) {
super.onComponentTag(componentTag);
String src=componentTag.getString("src");
componentTag.put("src", src+"&rand="+Math.random());
}
}
I didn't use the WebMarkupContainer method, since I wasn't sure how
you integrate the BufferedDynamicImageResource with it. I have a string
label which also gets Ajax updated, and that works. Just that the SRC
attribute never gets updated. I tried inspecting it with Firefox
JavaScript console, and the live value of the SRC attribute reported in
the console never changes.
In any case, if one calls Resource.setCacheable(false), shouldn't
Wicket add the no-cache HTTP headers, and/or anti-caching URLs (if they
are needed for Ajax)? In any case, I'm still mystified while my SRC
attribute isn't being modified. I have verified that the onComponentTag
method is getting called on every Ajax call, and that the URL is being
returned correctly. I have a feeling that the client-side JavaScript has
issues.
-Ray
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop