[Solved] Java – How can I download a non-cached version of a file? [closed]


You can add certain cache control headers to the HTTP request and/or response to prevent the use of cached copies. It’s also possible to suppress caching for an entire site, although this is generally ill-advised. See the spec for details about what to add.

Specifically, you can add this header:

cache-control: no-cache

to the request headers. See here for more cache-control syntax.

Note that some HTTP caches do not always respect these headers, so you may need to take other steps, such as adding so-called “cache-busting” extra data to the URI. See, for instance, this thread for one such technique.

If you can use POST instead of GET, that should eliminate most caching problems, because POST responses are not supposed to be cached.

1

solved Java – How can I download a non-cached version of a file? [closed]