Question
July 29, 2008 at 02:30 AM
andynagel2000

Clearing outdated textfile downloads in an applet

by andynagel2000 . Updated 18 years ago

Hi everybody,

Looking for a way to clear the java apllet download cache. (not the browser cache, text files that the applet has accessed via URL)

I’ve been reading this site and getting great info, but this is my first post, so I’m real curious to see if someone can help. I’m pretty frustated, so I hope someone reads this, knows what I’m talking about, and takes the time to straighten me out.

So, my problem is with a java applet making a URL connection to downoad text. But when the applet submits new parameters, the text files change on the server side, but not on the client side. The client sees the same file name and URL, so it seems to be using the versions it has in Cache. I’ trying to learn how to force the applet to re-download the textfiles and/or clear the temporary files.

Specifically, it’s an applet that passes some parameters to a servlet I created.

The servlet uses a construction like:

Runtime rt = Runtime.getRuntime();
Process p = rt.exec(command);
p.waitFor();

The servlet is using the command line to call C++ built executables that the civil engineering students I work with created using MATLAB compiler. The executables write the output to text files on the server, and when they terminate, the servlet writes the number of data points to the applet so the applet can allocate memory.

Then the applet downloads the datafiles directly as plaintext through a
dataUrl = new URL (“127..blah”);
PrintWriter out = response.getWriter();
out.write(data);

The applet then draws the data. It works perfectly fine when it’s initiated with default parameters. Then I change a parameter in the applet/browser. The text files on the server side are writeen with the correct data, but on the client side, it uses the cached versions of displacement.txt, acceleration.txt, and groundmotion.txt. So, my applet dispays the same data it had before, even though the sever side .txt files have changed.

So far, all my on-line searches hit people trying to figure out how to get their browser to load new class files after they alter their java code and rebuild, but that isn’t really my issue, the class files are fine, it’s ust the downloaded textfiles they interact with that need to be updated.

I’m fine with sharing my source and environment details with anyone if they think they can help, this is a student/research project, not industry.

Any help is much, much appreciated.
Thanks,
Andy

This discussion is locked

All Comments