ETag not received back if request made from differ

2019-07-23 20:58发布

问题:

I am trying to track a unique ID using ETag.

below are the two URLs being used -

GET Request 1 - localhost:8080/testTag/hitApi.html?name=user1&id=123
GER Request 2 - localhost:8080/testTag/hitApi.html?name=user2&id=123

Issues are -

  1. Whenever i refresh the same browser tab (request 1), i am not receiving the values in request header as expected.

  2. ETag not received as sent earlier if there is any change in get request Parameters, i.e, getRequest 1 and getRequest 2 and not giving the same if-none-match in request header

  3. If a send same ajax request multiple times from same function, i receive ETag and last-modified-since and if-none-match

What I want to achieve is that once I set ETag in response header, I get the values on the controller back no matter it is the same tab or different Tab or change in get Request parameters. Can this be done using ETags or not? If yes, Can anybody please point out what is wrong in my approach.

Application is deployed on tomcat 7 server and Java version is 1.6.