From cbaf29aeb7525deb1f81426c7d4d6cd9f39f500d Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 16 Aug 2017 00:36:49 +1200 Subject: Make cache control configurable --- src/org/traccar/web/WebServer.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/org/traccar') diff --git a/src/org/traccar/web/WebServer.java b/src/org/traccar/web/WebServer.java index 83ead7ad8..9b4b566ef 100644 --- a/src/org/traccar/web/WebServer.java +++ b/src/org/traccar/web/WebServer.java @@ -29,6 +29,7 @@ import org.glassfish.jersey.jackson.JacksonFeature; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.servlet.ServletContainer; import org.traccar.Config; +import org.traccar.Context; import org.traccar.api.AsyncSocketServlet; import org.traccar.api.CorsResponseFilter; import org.traccar.api.ObjectMapperProvider; @@ -105,7 +106,10 @@ public class WebServer { resourceHandler.setWelcomeFiles(new String[] {"debug.html", "index.html"}); resourceHandler.setMinMemoryMappedContentLength(-1); // avoid locking files on Windows } else { - resourceHandler.setCacheControl("max-age=3600,public"); + String cache = config.getString("web.cacheControl"); + if (cache != null && !cache.isEmpty()) { + resourceHandler.setCacheControl(cache); + } resourceHandler.setWelcomeFiles(new String[] {"release.html", "index.html"}); } handlers.addHandler(resourceHandler); -- cgit v1.2.3