From 047066557161b05be342e22d318a648d18e992c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laurent=20Gr=C3=A9goire?= Date: Thu, 2 Jul 2015 10:40:21 +0200 Subject: [PATCH] Add option "--disableFileCache" for development. --- .../opentripplanner/standalone/CommandLineParameters.java | 3 +++ .../java/org/opentripplanner/standalone/GrizzlyServer.java | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/opentripplanner/standalone/CommandLineParameters.java b/src/main/java/org/opentripplanner/standalone/CommandLineParameters.java index 45c43930487..75b0f91067b 100644 --- a/src/main/java/org/opentripplanner/standalone/CommandLineParameters.java +++ b/src/main/java/org/opentripplanner/standalone/CommandLineParameters.java @@ -106,6 +106,9 @@ public class CommandLineParameters implements Cloneable { description = "Path to directory containing local client files to serve.") public File clientDirectory = null; + @Parameter(names = {"--disableFileCache"}, description = "Disable http server static file cache. Handy for development.") + public boolean disableFileCache = false; + @Parameter(names = {"--router"}, validateWith = RouterId.class, description = "One or more router IDs to build and/or serve, first one being the default.") public List routerIds; diff --git a/src/main/java/org/opentripplanner/standalone/GrizzlyServer.java b/src/main/java/org/opentripplanner/standalone/GrizzlyServer.java index d52b92720c4..910ebb4d0e1 100644 --- a/src/main/java/org/opentripplanner/standalone/GrizzlyServer.java +++ b/src/main/java/org/opentripplanner/standalone/GrizzlyServer.java @@ -95,7 +95,11 @@ public void run() { httpServer.getServerConfiguration().addHttpHandler(dynamicHandler, "/otp/"); /* 2. A static content handler to serve the client JS apps etc. from the classpath. */ - HttpHandler staticHandler = new CLStaticHttpHandler(GrizzlyServer.class.getClassLoader(), "/client/"); + CLStaticHttpHandler staticHandler = new CLStaticHttpHandler(GrizzlyServer.class.getClassLoader(), "/client/"); + if (params.disableFileCache) { + LOG.info("Disabling HTTP server static file cache."); + staticHandler.setFileCacheEnabled(false); + } httpServer.getServerConfiguration().addHttpHandler(staticHandler, "/"); /*