This content has been marked as final. Show 3 replies
This is a bit of a hack and I'm checking into the headers option now. But this should work:
dataService.url = "servlet/dwservlet?requestAction=loadTemplates&dummy="+(new Date()).time;
This puts a unique dummy parameter to the request and fools the browser because the browser sees that the URL is unqiue - it is the URL that browser uses to determine if it should cache the result or not.
This assumes your servlet won't complain about an extra parameter.
Yes the dummy parameter works but is not suitable because if the response, in this case xml, is very large it will fill up the user cache fairly quickly since every request is unique. Please help with setting headers.
Turns out that you have to do this from the server-side. It is the server response header's that tell the browser not to cache the data.
When you request a plain file, such as an XML file, there isn't any way to get the server to stuff the response header with the no-cache option. That is, unless there is a way for the web server or app server to have a default value.
To do this, you'd have to request your file via PHP, JSP, or something that can change the response header.
Since you are using a servlet you should be able to get that to modify the response header to include Cache-control: no-cache (as well as Pragma and Expires - you should do them all in case one browser doesn't recognize your option).