Forum Stats

  • 3,769,970 Users
  • 2,253,039 Discussions
  • 7,875,254 Comments

Discussions

webstart cache fails to update file

1056969
1056969 Member Posts: 4
edited May 29, 2015 7:15PM in Java Web Start & JNLP

I've narrowed down a file caching problem we have, where clients that modify files on the server are unable to see these changes within the webstart application.  One server doesn't see the issue.  I have the file http://www-pw.physics.uiowa.edu/~jbf/autoplot/changing/temp.htm which is updated once every minute (with a cron job) and our software that plots this data can see the changes.  The other server, which is updated via svn, doesn't propagate updates when I update the file.  See http://emfisis.physics.uiowa.edu/pub/jy/dev/jbf/20150515_bug1393/temp.htm.

Here are the response headers on the working server, before and after a change:

HTTP/1.1 200 OK

Date: Fri, 15 May 2015 19:51:35 GMT

Server: Apache/2.0.63

Last-Modified: Fri, 15 May 2015 19:51:03 GMT

ETag: "51dc74f-211-2a0297c0"

Accept-Ranges: bytes

Content-Length: 529

Keep-Alive: timeout=15, max=100

Connection: Keep-Alive

Content-Type: text/html

-----

HTTP/1.1 200 OK

Date: Fri, 15 May 2015 20:01:00 GMT

Server: Apache/2.0.63

Last-Modified: Fri, 15 May 2015 20:00:03 GMT

ETag: "51dc74f-20f-4a3256c0"

Accept-Ranges: bytes

Content-Length: 527

Keep-Alive: timeout=15, max=100

Connection: Keep-Alive

Content-Type: text/html

And on the non-working server that doesn't work, before and after the change

HTTP/1.1 200 OK

Date: Fri, 15 May 2015 20:07:20 GMT

Server: Apache/2.4.7 (Ubuntu)

Last-Modified: Fri, 15 May 2015 20:07:02 GMT

ETag: "217-51624632eaaa3"

Accept-Ranges: bytes

Content-Length: 535

Vary: Accept-Encoding

Keep-Alive: timeout=5, max=100

Connection: Keep-Alive

Content-Type: text/html

-----

HTTP/1.1 200 OK

Date: Fri, 15 May 2015 20:09:18 GMT

Server: Apache/2.4.7 (Ubuntu)

Last-Modified: Fri, 15 May 2015 20:09:02 GMT

ETag: "210-516246a5fc440"

Accept-Ranges: bytes

Content-Length: 528

Vary: Accept-Encoding

Keep-Alive: timeout=5, max=100

Connection: Keep-Alive

Content-Type: text/html

Does anyone know why webstart would work fine with one server but not the other?  Is there anything I can do to disable caching in webstart, that would still allow the .jar files to be cached?  I've tried experimenting with this on a single-jar release that doesn't use webstart, and it seems to work fine from both websites.

Thanks,

Jeremy

Answers

  • 1056969
    1056969 Member Posts: 4
    edited May 17, 2015 7:17AM

    Actually on a second machine, neither of the addresses is updating.  So is there a way that the webstart program could programmatically clear the cache, or force a reload?

  • 1056969
    1056969 Member Posts: 4
    edited May 21, 2015 3:52PM

    I was able to work around this by using the method urlConnection.setUsesCache(false), which I probably want anyway.  I do believe there is a bug in the caching mechanism, and if anyone is capable of addressing it I would be happy to work with them.  It might be worth mentioning that I do a HEAD request before the GET request, so I can manage my own cache, and perhaps this is why no one else has seen the problem.

  • jlanawalt
    jlanawalt Member Posts: 41
    edited May 29, 2015 7:15PM

    Were you able to reproduce the issue when not running under Web Start?

    I don't know what your permissions and settings are but while the Web Start sandbox does introduce some differences, DNS lookup caching being a related example, I don't remember URLConnection caching being one of them.

    I also wanted more control over caching due to issues with file time stamp being wrong or just not precise enough and trusting the last-modified header over the etag, so I setUsesCache(false) and manage my own header cache along with the downloaded resource. I don't use the HEAD request to do this though. On a 200 response I getHeaderField for a list of headers I care about, loading them into a Properties object then writing that out to a file. When I make the request for the same URL later I load the cached properties and use the Last-Modified value to set the value of the If-Modified-Since header, or if that doesn't exist the ETag value to the If-None-Match. It has seemed to work fine.

    --

    Jacob

This discussion has been closed.