ok2c commented on PR #532:
URL: 
https://github.com/apache/httpcomponents-client/pull/532#issuecomment-1876783497

   ```
   final ClassicHttpRequest httpget1 = ClassicRequestBuilder.get()
           .setHttpHost(target)
           .setPath("/")
           .build();
   
   final HttpCacheContext context = CacheContextBuilder.create()
           .setCacheControl(RequestCacheControl.builder()
                   .setMinFresh(100)
                   .build())
           .build();
   
   System.out.println("Executing request " + httpget1.getMethod() + " " + 
httpget1.getUri());
   httpclient.execute(httpget1, context, response -> {
       System.out.println("----------------------------------------");
       System.out.println(httpget1 + "->" + new StatusLine(response));
       EntityUtils.consume(response.getEntity());
       System.out.println("Cache status: " + context.getCacheResponseStatus());
       System.out.println("Request cache control: " + 
context.getRequestCacheControl());
       System.out.println("Response cache control: " + 
context.getResponseCacheControl());
       final HttpCacheEntry cacheEntry = context.getCacheEntry();
       if (cacheEntry != null) {
           System.out.println("Cache entry resource: " + 
cacheEntry.getResource());
           System.out.println("Date: " + cacheEntry.getInstant());
           System.out.println("Expires: " + cacheEntry.getExpires());
           System.out.println("Last modified: " + cacheEntry.getLastModified());
       }
       return null;
   });
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org
For additional commands, e-mail: dev-h...@hc.apache.org

Reply via email to