[GitHub] coheigea commented on a change in pull request #475: Make org..client.cache.Entry serializable (cache by value), handle 30…

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[GitHub] coheigea commented on a change in pull request #475: Make org..client.cache.Entry serializable (cache by value), handle 30…

GitBox
coheigea commented on a change in pull request #475: Make org..client.cache.Entry serializable (cache by value), handle 30…
URL: https://github.com/apache/cxf/pull/475#discussion_r238771410
 
 

 ##########
 File path: rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/cache/CacheControlClientRequestFilter.java
 ##########
 @@ -64,7 +66,15 @@ public void filter(final ClientRequestContext request) throws IOException {
             //TODO: do the extra validation against the conditional headers
             //      which may be contained in the current request
             if (entry.isOutDated()) {
-                cache.remove(key, entry);
+                String ifNoneMatchHeader = entry.getCacheHeaders().get(HttpHeaders.IF_NONE_MATCH);
+                String ifModifiedSinceHeader = entry.getCacheHeaders().get(HttpHeaders.IF_MODIFIED_SINCE);
+                
+                if (StringUtils.isEmpty(ifNoneMatchHeader) && StringUtils.isEmpty(ifModifiedSinceHeader)) {
+                    cache.remove(key, entry);
+                } else {
+                    request.getHeaders().add(HttpHeaders.IF_NONE_MATCH, ifNoneMatchHeader);
 
 Review comment:
   I think you're also missing this:
   request.getHeaders().add(HttpHeaders.IF_MODIFIED_SINCE, ifModifiedSinceHeader);

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[hidden email]


With regards,
Apache Git Services