0

We have a automation testing tool to record and replay. We will launch this tool using jnlp file.

After opening the tool, if we record on a instance, response is fine. But if we record on the same instance second time, getting cached response.

If we close the tool and record, working fine. So, getting problem when our tool is alive. We are using HTTPURLConnection to read response from Server. We tried setting the headers Pragma:no-cache", "Cache-Control:no-cache,no-store,must-revalidate. But no use.

Here is our code snippet...

OutputStream sharedProxyNWebOutStream = null;
URL requestURL = new URL(requestFromBrowser.url());
HttpURLConnection webConnection =(HttpURLConnection)requestURL.openConnection();
webConnection.setDoOutput(true);
sharedProxyNWebOutStream = webConnection.getOutputStream();
sharedProxyNWebOutStream.write(requestFromBrowser.data());

We have tried all solutions mentioned in the Java - HttpUrlConnection returns cached response every time. But no luck.

  • 2
    Possible duplicate of [Java - HttpUrlConnection returns cached response every time](https://stackoverflow.com/questions/34534945/java-httpurlconnection-returns-cached-response-every-time) – Piro Apr 02 '18 at 17:26
  • I tried all solutions mentioned in that url. But no luck.. – Srilakshmi Chandolu Apr 02 '18 at 17:44
  • 1
    You should [edit] your question to show how you've ruled out all of the suggestions in the other post. – Kenster Apr 02 '18 at 19:07

0 Answers0