This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills and have John Sonmez on-line!
See this thread for details.
The moose likes Servlets and the fly likes Do applets Download every time you visit the page? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Do applets Download every time you visit the page?" Watch "Do applets Download every time you visit the page?" New topic
Author

Do applets Download every time you visit the page?

Kevin Onik
Ranch Hand

Joined: Sep 10, 2003
Posts: 30
Hi friends..
I have a good experience in Java App programming,but nothing about developping Applets!!!
I'm going mke decision about using Applets in our new J2EE project.
Can anyone please answer my question? ( I know that it may seem FUNNY!! but I coulden't find the answer!!)
Let's say I have an applet with the size of 1MB "MyApplet.class" size,when someone loads the page, contains it for the first time it's clear that the .class file must loadup, but what about the secound time?
It loads up again?? Is there any way to prevent this ( I mean from reloading the applet... for example like FLASH files??)
And if it's possible, how can I tell the browser that a new version of the Applet file is on the server?
( I have read the Tutorial at the Sun but couldn't find a help ! )
Can anyone please recommand a good book on (Just Applets)?
Thank you so much


"The greatest pleasure in life is doing what people say you cannot do." --Walter Bagehot<p>SCJP 1.4<br />SCWCD 1.3</p>
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Applets -- the JAR files or .class files -- are cached by the browser just like any other resource. You can control this just as you'd control caching of any other file ("Expires" and "Pragma: No-cache" headers, etc.)


[Jess in Action][AskingGoodQuestions]
Kevin Onik
Ranch Hand

Joined: Sep 10, 2003
Posts: 30
Dear Ernest
Thank you for your response
But how can I tell the browser that the .class files are updated?
( I don't know when they may update! So how can I set the "expires" ?)
And it's very kind of you if you write me an Example? :roll:
[[And your explanations led me to the correct way to find the answer!!
Thank you ]]
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Most browsers automatically ask the server if it has a file that's newer than a cached file using a HEAD query; if the server's file is newer, then the new version is downloaded, and you don't have to do anything special. This is going to be fine for 99% of cases. So probably you don't have to do anything at all.
Kevin Onik
Ranch Hand

Joined: Sep 10, 2003
Posts: 30
Thank you SO MUCH!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Do applets Download every time you visit the page?