Solved

Sun Plugin Applet URLConnection doesn't use IE browser cache

Posted on 2003-11-30
32
878 Views
Last Modified: 2013-11-18
I have a legacy applet that works fine under the old MS and Netscape jvms.  However, when I try to run it under the Sun plugin jvm (1.4.2_01), I see that the URLConnection doesn't use the browser cache.  It just reads the data directly into the applet bypassing checking to see if the file was already in IE's /Temporary Internet Files/Content.IE5.  Even after the read of the file, it's still not in the browser's cache.
I've confirmed this by monitoring the data coming over the wire with ethereal and monitor what files are being written/read from my computer using filemon.
I do have
urlc.setUsesCache(true);
and even tried
urlc.setDefaultUseCaches(true);
  Doesn't help and as I said, this code has been working fine for the past 4 years in the old netscape 4 and IE w/ MS JVM environments.
  Is there some other class that I should now be using with the Sun plugin to take advantage of the browser cache?
Thanks!
0
Comment
Question by:dcpetersonp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 13
  • 9
  • 6
  • +1
32 Comments
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 75 total points
ID: 9846186
The plugin has its own cache in the file system
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 9846194
This is a bit out of date, but should help:

http://java.sun.com/products/plugin/1.3/docs/appletcaching.html
0
 
LVL 1

Author Comment

by:dcpetersonp
ID: 9846216
That cache is for applet jar files.  I'm talking about downloading normal media files.  I'm dowloading very large files (e.g. .jpg, .swf, .avi, etc) and I need to take advantage of the normal IE browser content cache.
0
The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

 
LVL 86

Expert Comment

by:CEHJ
ID: 9846233
Are these not contained in jar files? If you put them in jar files, not only should you get the cache control mentioned above, but in some cases, compression optimisations.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 9846244
Individual files may be placed in the .jpi_cache directory
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 9846250
See the comment here too on URLConnection/classpath issues:

http://forum.java.sun.com/thread.jsp?thread=458347&forum=421&message=2109189
0
 
LVL 1

Author Comment

by:dcpetersonp
ID: 9846265
I definitely want cache controls.
The nature of my applet's functionality prevents them from being put into jar files as I want to use them in later html pages as real files outside of my applet context.  i.e. I want the browser to see them there, not just have them available to my applet.  Not only do I want the browser to see them there, I'd like the browser to see the expiration header cache controls just like it does for the old jvms.
Also, as I said above, filemon shows that no files are being written to my disk, not even to .jpi_cache.  In fact later examination of .jpi_cache/file/1.0 shows nothing there.  However, I do certainly see my applet jar file in .jpi_cache/jar/1.0
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 9846278
Maybe try a classpath-oriented method of loading the files, per the above link?
0
 
LVL 1

Author Comment

by:dcpetersonp
ID: 9846279
Yes, I've already read that java forum posting.  My apache server is definitely not setting no-cache pragmas.  As I said, this works perfectly fine with legacy jvms.  You may also want to read this java forum posting:

http://forum.java.sun.com/thread.jsp?forum=30&thread=348986&start=0&range=15#2164058
0
 
LVL 1

Author Comment

by:dcpetersonp
ID: 9846294
classpath loading mechanism?  Yes, I've read that posting before, but I don't understand what they mean by classpath loading mechanism.  However, I think that point may be moot (although for my own edification, I wouldn't mind understanding what they're suggesting) because I need the files to be seen by the browser outside of my applet context.  The primary purpose of my applet is to pre-cache files for later usage in normal browser context.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 9846367
>>I wouldn't mind understanding what they're suggesting

I assume something like

URL myMediaUrl = getResource("/media/x.avi");

or

InputStream in = getResourceAsStream("/media/x.avi");
0
 
LVL 92

Accepted Solution

by:
objects earned 125 total points
ID: 9846384
Use of browser cache is an RFE.
0
 
LVL 1

Author Comment

by:dcpetersonp
ID: 9846524
DO you have a link to the RFE so I can vote for it?  
Changing the way URLConnection has worked for the last 10 years w/o allowing for backward compatibility really stinks in my opinion.
So as far as you know, there isn't any mechanism for me to download a file and have it available for non-applet contexts?  No way to get it into the browser's cache?  I can't think of one.  I've tried to think of a way to pass it to javascript, but I can't think of how that would even work.
0
 
LVL 92

Expert Comment

by:objects
ID: 9846525
Last I checked the browser cache is only consulted for jar and class files. So the only workaround I know of is to rename your files extensions which doesn't help with sharing cached files with browser.

There are plans to check browser cache for all files in hopper, but that also is not a lot of help to you now.
0
 
LVL 92

Expert Comment

by:objects
ID: 9846528
0
 
LVL 1

Author Comment

by:dcpetersonp
ID: 9846574
Just for my own political commentary here, Sun developed the plugin because MS was removing support for their JVM.  You'd think that SUN would take a bit more care to make sure that things worked in the same fashion.
I've added in a bit of commentary to that RFE because it just asks for the plugin to check the browser cache.  In actuality I'd like it to check it and (at least optionally) deposit into it regardless of filetype extension.
0
 
LVL 1

Author Comment

by:dcpetersonp
ID: 9846582
Well, my problem isn't at all solved here, but you've been a big help in at least pointing me to where to apply leverage on Sun.  What do you think is a fair point assessment here for your help?
0
 
LVL 92

Expert Comment

by:objects
ID: 9846619
> Sun developed the plugin because MS was removing support for their JVM.  

Not really. MS removed support for their JVM well after the plugin was developed.

> You'd think that SUN would take a bit more care to make sure that things worked in the same fashion.

Agreed, there are some areas that Sun really needs to improve.

> What do you think is a fair point assessment here for your help?

They are your points, it up to you :)
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 9846657
>>What do you think is a fair point assessment here for your help?
     
I certainly don't mind if objects gets the majority of the points as he's probably provided more help
0
 
LVL 1

Author Comment

by:dcpetersonp
ID: 9846669
Okay, I've asked the moderators to award 75 points each to you both and to leave this open for a while.  Not sure if they can do that or not.  I'm hoping for a solution out of left field that may solve this for me, but I don't think you guys should be penalized waiting around for that.  Thanks objects & CEHJ!
0
 
LVL 1

Author Comment

by:dcpetersonp
ID: 9846689
great, I've asked them to switch it to 125/75 split.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 9846699
:-)
0
 
LVL 92

Expert Comment

by:objects
ID: 9846962
0
 
LVL 1

Author Comment

by:dcpetersonp
ID: 9851828
Hey, can I impose on you guys to ask that you vote for this RFE please?

http://forum.java.sun.com/thread.jsp?forum=30&thread=348986&start=0&range=15#2164058 
0
 
LVL 92

Expert Comment

by:objects
ID: 9852379
My votes are all in use sorry.

0
 
LVL 9

Expert Comment

by:GivenRandy
ID: 11514207
We are having a similar problem -- when using the Plugin cache_option, it does not cache like it should. Could be something wrong with cache_version, I have heard. Have you guys found a fix for this problem?
0
 
LVL 1

Author Comment

by:dcpetersonp
ID: 11514300
Sun acknowledges that this is a missing 'feature'.  Suggest that you cast your votes w/ Sun to have the 'feature' implemented.  Get all of your co-workers, friends, family, etc to vote. We've managed to get the votes up to 131, but still Sun isn't working on it.  Pile your votes on. ;)
http://developer.java.sun.com/developer/bugParade/bugs/4528599.html
0
 
LVL 9

Expert Comment

by:GivenRandy
ID: 11514337
Now it is 132. Grrr.
0
 
LVL 1

Author Comment

by:dcpetersonp
ID: 11514354
FYI, you have 3 votes that you can cast.  Course you may be using the other 2 for something else....
0
 
LVL 9

Expert Comment

by:GivenRandy
ID: 11514452
134. Didn't know you could put all three on one.
0
 
LVL 1

Author Comment

by:dcpetersonp
ID: 11515767
Top 25 RFEs (request for enhancement).  You can see where we're at via the link below.  Suggest that you get friends, colleagues, whoever to vote because we're not really going anywhere fast with getting a solution for this.  About our only hope is if Microsoft and Sun partner together to put SunJava bundled into windows.  If that happens, I'm sure MS will push Sun hard to fix these things and probably even assign their own engineers to fix/test that it all runs 100% on windows.
RFEs
http://bugs.sun.com/bugdatabase/top25_rfes.do
Bugs
http://bugs.sun.com/bugdatabase/top25_bugs.do
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article you will learn how to create a free basic website on Bitbucket, a git service provider. Polymer creates dynamic HTML components, which allow more flexibility than static HTML. This tutorial uses Ubuntu Linux but can also be done on W…
In this post we will learn different types of Android Layout and some basics of an Android App.
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question