Announcement Announcement Module
Collapse
No announcement yet.
Handling of HttpStatus Not Modified (304) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Handling of HttpStatus Not Modified (304)

    Hi there,

    I have implemented the ETag header on the server side and would like to know how to handle this case on the client.
    Right now, I have:

    Code:
    ResponseEntity<MyObject> responseEntity = restTemplate.exchange(url,
                            HttpMethod.GET, requestEntity, MyObject.class);
    As a 304 response does not send back a body, I get a: ResourceAccessException

    What is the best way to treat the 304 case?

    Thanks in advance

    Olivier

  • #2
    Hi Olivier, a 304 response simply means the content has not changed, so to save bandwidth the server is not returning the same content again. How you handle this depends on the requirements of the client. You may want to cache the data from a previous request, and use that cached data when you receive a 304.

    -Roy

    Comment

    Working...
    X