diff options
Diffstat (limited to 'src/main/java/org/traccar/web')
-rw-r--r-- | src/main/java/org/traccar/web/WebServer.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/main/java/org/traccar/web/WebServer.java b/src/main/java/org/traccar/web/WebServer.java index 92e0ca958..82e9397e4 100644 --- a/src/main/java/org/traccar/web/WebServer.java +++ b/src/main/java/org/traccar/web/WebServer.java @@ -134,7 +134,7 @@ public class WebServer { private void initWebApp(Config config, ServletContextHandler servletHandler) { ServletHolder servletHolder = new ServletHolder(DefaultServlet.class); - servletHolder.setInitParameter("resourceBase", new File(config.getString("web.path")).getAbsolutePath()); + servletHolder.setInitParameter("resourceBase", new File(config.getString(Keys.WEB_PATH)).getAbsolutePath()); if (config.getBoolean(Keys.WEB_DEBUG)) { servletHandler.setWelcomeFiles(new String[] {"debug.html", "index.html"}); } else { @@ -150,9 +150,10 @@ public class WebServer { private void initApi(Config config, ServletContextHandler servletHandler) { servletHandler.addServlet(new ServletHolder(new AsyncSocketServlet()), "/api/socket"); - if (config.hasKey("media.path")) { + String mediaPath = config.getString(Keys.MEDIA_PATH); + if (mediaPath != null) { ServletHolder servletHolder = new ServletHolder(DefaultServlet.class); - servletHolder.setInitParameter("resourceBase", new File(config.getString("media.path")).getAbsolutePath()); + servletHolder.setInitParameter("resourceBase", new File(mediaPath).getAbsolutePath()); servletHolder.setInitParameter("dirAllowed", "false"); servletHolder.setInitParameter("pathInfoOnly", "true"); servletHandler.addServlet(servletHolder, "/api/media/*"); |