How do I prevent caching of HTTP requests?
By default, caching will be enabled. You must use a URLConnection, rather than the URL.openStream() method, and explicitly specify that you do not want to cache the requests. This is achieved by calling the URLConnection.setUseCaches(boolean) method with a value of false.
// Create a URLConnection object URLConnection connection = myURL.openConnection(); // Disable caching connection.setUseCaches(false); // Connect to remote machine connection.connect();