Added evaluation of Cache-Control HTTP header

This commit is contained in:
jvi 2019-10-11 13:40:17 +02:00 committed by James Agnew
parent ff4fba15c9
commit 6a2242656f
1 changed files with 14 additions and 6 deletions

View File

@ -26,6 +26,8 @@ import java.util.concurrent.atomic.AtomicReference;
import ca.uhn.fhir.interceptor.api.HookParams;
import ca.uhn.fhir.interceptor.api.Pointcut;
import ca.uhn.fhir.rest.api.CacheControlDirective;
import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor;
import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
import org.hl7.fhir.instance.model.api.IBaseConformance;
@ -77,15 +79,21 @@ public class ConformanceMethodBinding extends BaseResourceReturningMethodBinding
public IBundleProvider invokeServer(IRestfulServer<?> theServer, RequestDetails theRequest, Object[] theMethodParams) throws BaseServerResponseException {
IBaseResource conf;
conf = myCachedResponse.get();
if ("true".equals(System.getProperty("test"))) {
CacheControlDirective cacheControlDirective = new CacheControlDirective().parse(theRequest.getHeaders(Constants.HEADER_CACHE_CONTROL));
if (cacheControlDirective.isNoCache())
conf = null;
}
if (conf != null) {
long expires = myCachedResponseExpires.get();
if (expires < System.currentTimeMillis()) {
else {
conf = myCachedResponse.get();
if ("true".equals(System.getProperty("test"))) {
conf = null;
}
if (conf != null) {
long expires = myCachedResponseExpires.get();
if (expires < System.currentTimeMillis()) {
conf = null;
}
}
}
if (conf != null) {
// Handle server action interceptors