Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Problem refreshing html-on-a-prim

Waffle Projects
Registered User
Join date: 9 Aug 2006
Posts: 38
07-29-2009 12:02
I have a Java servlet that dynamically creates images (data visualizations) and would like to point a prim at it to display the latest image created by the servlet. Unfortunately, it does not seem to refresh very frequently. Even if I script it to reload the image on a touch event, when it reloads, it still often shows the older version of the image. It will finally show the latest one only after a few minutes have passed. Is there any way to force it to use the latest one?

My code to reload the image is simply:
llParcelMediaCommandList ( [ PARCEL_MEDIA_COMMAND_UNLOAD ] );
llParcelMediaCommandList ( [ PARCEL_MEDIA_COMMAND_PLAY ] );

thanks!
skidz Tweak
Registered User
Join date: 18 Apr 2006
Posts: 42
Hi..
07-30-2009 01:07
The problem is your caching the image. You can edit the Server settings to expire the content imminently. I know under IIS its found in the properties of the site on the HTTP Header tab. Just check Enable content expiration and set it for a negative time.

I have something else that does fix that as well. My free web prim does some tricks that help prevent that from happening. It only refreshes on touch, but has a lot of other great features as well.
.
Xstreet:
https://www.xstreetsl.com/modules.php?name=Marketplace&file=item&ItemID=1603934
Here is a video of it as well:
http://www.youtube.com/watch?v=I3A-xKLjHxo&feature=channel_page
See it in action on Skidz Isle sandbox as well:
http://slurl.com/secondlife/Skidz%20Isle/5/39/33

See.. look, I helped before I spammed this time, and its a freebie :D lol
skidz Tweak
Registered User
Join date: 18 Apr 2006
Posts: 42
Also
07-30-2009 01:23
Also you can edit the Server settings to expire the content imminently. I know under IIS its found in the properties of the site on the HTTP Header tab. Just check Enable content expiration and set it for a negative time.
Ron Khondji
Entirely unlike.
Join date: 6 Jan 2007
Posts: 224
07-30-2009 01:45
Only resetting the url in the llParcelMediaCommandList() should do the trick.
To prevent reloading a cached page you can add a random number to the url.

Like:

CODE

string url = "http://www.something.com/index.html";
llParcelMediaCommandList([PARCEL_MEDIA_COMMAND_URL, url + "?" + (string)((integer)llFrand(1234567))]);


p.s. :) @ Skidz
skidz Tweak
Registered User
Join date: 18 Apr 2006
Posts: 42
Yeppers
07-30-2009 02:11
Yea.. thats exactly what I do with the free web prim :) With some extra checks in place to ensure I don't mess up the URL.
Waffle Projects
Registered User
Join date: 9 Aug 2006
Posts: 38
07-30-2009 06:47
I tried inserting a random number and it still doesn't work. Also, it's not caching on the server. If I open the same URL in a regular web browser, it is always up to date. I also tried opening it in SL's Media Browser, and that shows an out of date image as well.
Waffle Projects
Registered User
Join date: 9 Aug 2006
Posts: 38
07-30-2009 06:56
OK, so it's definitely being cached client side, as clearing the cache on the client leads to it getting the appropriate update. So somehow the client caching is ignoring the random extra parameter. Granted, I'm not adding the random bit to the URL in quite exactly the way you said. The URL already has some parameters in it (again, this is a servlet, so you pass it some parameters and it returns you a dynamically generated image.) So instead, I'm just adding another '&' plus a random number string. would that be ignored by the caching mechanism?
skidz Tweak
Registered User
Join date: 18 Apr 2006
Posts: 42
07-30-2009 07:32
It is caching client side, but the server can send header data telling it to expire. This happens from the server like I described before. Not sure if it would work, but I would hope it would. Otherwise the client that makes the image that is displayed in SL is ignoring the headers.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
07-30-2009 13:34
you may be able to force clear the cache by attempting to load a non-existant page (or even a valid one) instead of clearing the old one, as it's probably just not making a new request on play (which to me, suggests that unload is buggy) or perhaps actually SET the old address after unload, before playing.

it's also possible that play is reading the "current position" and so obeying the cached version position, and waiting for the end of it's loop, which in this case is probably the next update check to the server, in which case stop then play might work.
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -