The first approach (setting header) as u had guesssed, didn't worked....(can
u please tell the reason)

But the second(http://localhost/servlet/ImageServlet;123456789) worked !!!!

But is there any cleaner method to get the result ?

-----Original Message-----
From: Mathias H�ggren [mailto:[EMAIL PROTECTED]]
Sent: 20 March 2002 10:34
To: [EMAIL PROTECTED]
Subject: SV: When does a servlet reloads/recalculates ?


Hi!

>Could your browser be caching the image?

Images are cached really hard in browsers, specially IE. There are a few
ways of avoiding this. First of all, add this to your servlet to tell the
browser not to store the content in its cache:

  response.setHeader("Cache-Control", "no-cache");
  response.setHeader("Pragma", "no-cache");
  response.setIntHeader("Expires", 0);

This will minimize the browsercaching but it's not 100% accurate. To be
really sure the client recieves an uncached version of the image from your
servlet append a random number to the URL calling the image:

http://localhost/servlet/ImageServlet;123456789

or

http://localhost/servlet/ImageServlet?123456789

Make sure to use a pretty large span of numbers for this, you don't want two
identical requests from the same client.

Brgds
Mathias

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to