Image Widget Issues

  • 1
  • Question
  • Updated 3 years ago
  • Answered
I am guessing the newer release of the image widget is now up. The issue i am having with it is part to do with caching. I am getting the request and download it to cache. After that when i send the link back to cache and when it loads i get this error in the picture. The image will not show. 



Also third party urls are not caching like its posted on github. It doesn't send the request but it does show the images on the device unlike the images that come from the storage. 

I also think its time for rise to start a calendar system or something for third parties. I think i have been bitten by surprised updates or updates that come with no warning the past year. I understand change, but in an open source environment you need to communicate to grow. Without that you leave your contributors upset and want to stop. Please get better on this front. 

Thanks. 
Photo of William Oneal

William Oneal, Champion

  • 13,770 Points 10k badge 2x thumb

Posted 4 years ago

  • 1
Photo of Blake Freeman

Blake Freeman, Official Rep

  • 36,116 Points 20k badge 2x thumb
Hi William,

I'll get this over to our developer to take a look at.

I also agree with your suggestion of a release calendar for third parties. There has been some internal discussion on the subject, thanks for your suggestions!
Photo of Blake Freeman

Blake Freeman, Official Rep

  • 36,116 Points 20k badge 2x thumb
William,

I have spoken with the developer of this widget, and he is not certain that the Rise Storage Web Component is being used correctly in this case. Can you explain how you are using it with your player?

Third party URLs are not cached in the image widget.
Photo of William Oneal

William Oneal, Champion

  • 13,770 Points 10k badge 2x thumb
Yea pretty simple and this was working so whatever changed did this. At this point i get the request from rise with a URL. The url is downloaded so i do see it on the device in cache. My issue is when i send the request back to acknowledge where the location of the file, it gets me that error. The http://localhost:8085 is the location of the web server directory on the device. I guess what i need to figure out again is what is the response needed for returning the location of the image url. 
(Edited)
Photo of Blake Freeman

Blake Freeman, Official Rep

  • 36,116 Points 20k badge 2x thumb
William,

Can you tell me if this is an image stored on Rise Storage or a third party storage? Also, is this a problem on a display, or in preview?
(Edited)
Photo of William Oneal

William Oneal, Champion

  • 13,770 Points 10k badge 2x thumb
This is stored on rise storage. All other images work from third party since its not going through the caching system. The ones on storage gets cached to the device through normal caching and if this is any indication where the video widget heads then ill have another issue with that as well. 

Im thinking its either with my response back to the location of the image or something is causing a cross domain issue that simply should not be there. I didn't have this issue before so what has changed?
Photo of Blake Freeman

Blake Freeman, Official Rep

  • 36,116 Points 20k badge 2x thumb
William,

I'm going to need to run this by Donna. She's out for the Canadian Holiday today, but I'll get back to you as soon as I can.
Photo of Donna Peplinskie

Donna Peplinskie

  • 7,142 Points 5k badge 2x thumb
William,

I'm not entirely sure I understand the constraints under which you are running the Image Widget, but let me summarize how files are cached with the Image Widget and perhaps it will provide some clarity and an indication of where the problem may be.

For files coming from Rise Storage, the Image Widget uses the rise-storage web component. If Rise Cache is running, the process looks like this:
  • On initial load, make a request to get the file from Rise Cache. When Rise Cache responds, save the Last-Modified header and pass the Rise Cache URL on to the Image Widget for display.
  • On a refresh, make another request to get the file from Rise Cache. If the Last-Modified header has changed, pass the Rise Cache URL (with a cache buster appended) to the Image Widget for display.
If Rise Cache is not running, the process looks like this:
  • On initial load, make a request to get the file from Rise Storage. When Rise Storage responds, save the etag parameter and pass the Rise Storage URL on to the Image Widget for display.
  • On a refresh, make another request to get the file from Rise Storage. If the etag parameter has changed, pass the Rise Storage URL (with a cache buster appended) to the Image Widget for display.
Are you using custom code anywhere? You said that you "send the request back to acknowledge where the location of the file", which implies that you are. I'm trying to figure out if the problem is from the Image Widget side of things or from Rise Cache itself.

Thx.
Photo of William Oneal

William Oneal, Champion

  • 13,770 Points 10k badge 2x thumb
Yes I'm pretty much using the same code that i have been for the past few months. It was working but i think the header request for the url has changed. Could you give me a rundown of what headers are needed after the download. This would be the headers that is sent just before i send the location. I will say that i think the url I'm sending is getting there. Im just making sure where the cross domain issue is coming from. Usually its from sending incorrect headers, but sometimes it could be a permission on the actual client that requested the url location. 
(Edited)
Photo of Donna Peplinskie

Donna Peplinskie

  • 7,142 Points 5k badge 2x thumb
Are you asking what headers the Storage web component expects back from Rise Cache? If so, all it looks at in terms of headers is Last-Modified.

Thx.
Photo of William Oneal

William Oneal, Champion

  • 13,770 Points 10k badge 2x thumb
Im betting its the Last-Modified. I will see what happens when i add that in the mix. Also is there particular date format to last modified? 
Photo of Donna Peplinskie

Donna Peplinskie

  • 7,142 Points 5k badge 2x thumb
Not from the Storage component's perspective. All it does is a straight comparison, so if any part of that field has changed between requests, it will trigger the Image Widget to update.

Thx.
Photo of William Oneal

William Oneal, Champion

  • 13,770 Points 10k badge 2x thumb
I am looking at the old rise-storage.html compared to the new one thats on the image-widget and there is a few changes but it seems like the error I'm getting is getting caught up in the last modified section of the rise-storage.html. Even without the last modified being sent its getting stopped there. My only other question would be what is the format for last modified? Im using java to send request so it be something like this 

ps.print("Cache-Control: no-cache");

Only i need it to be last modified. Thanks. 
Photo of Donna Peplinskie

Donna Peplinskie

  • 7,142 Points 5k badge 2x thumb
Sorry, I'm not too familiar with Java but I would think you should just be able to pass the last-modified time of the actual file on the file system. To confirm, you have implemented your own caching mechanism and are not utilizing Rise Cache, is that correct?

Thx.
Photo of William Oneal

William Oneal, Champion

  • 13,770 Points 10k badge 2x thumb
Well somewhat. Im using parts of the old java caching system that was on the old native player with updated code that android uses to make it all work. Its not as elaborate as your caching system but it does work really well. Except when things change. A lot of reverse engineering.. Im going to test sending the added request and see what i get. If anything what is the full header that is sent or an example header that the image widget receives from the caching server in javascript. That way i can compare and get an idea. Thanks
Photo of Donna Peplinskie

Donna Peplinskie

  • 7,142 Points 5k badge 2x thumb
Here's a screen capture of the HTTP headers Rise Cache sends back - http://www.screencast.com/t/Tudhph9dxa. Then the component extracts just the Last-Modified header using getResponseHeader("Last-Modified").
(Edited)
Photo of William Oneal

William Oneal, Champion

  • 13,770 Points 10k badge 2x thumb
Thanks i can work with that :)
Photo of Donna Peplinskie

Donna Peplinskie

  • 7,142 Points 5k badge 2x thumb
Actually, after having re-read your original post, you likely need to set Access-Control-Allow-Origin to * as well.

Thx.
Photo of William Oneal

William Oneal, Champion

  • 13,770 Points 10k badge 2x thumb
I do. If you noticed in the image i posted, the error is coming from line 659 in rise-storage.html. This is where last modified is at so I'm thinking the error hits there and stalls out causing the cross domain issue.