diff options
author | Anton Tananaev <atananaev@lyft.com> | 2020-12-30 10:54:14 -0800 |
---|---|---|
committer | Anton Tananaev <atananaev@lyft.com> | 2020-12-30 10:54:14 -0800 |
commit | b7677cbcc610c775ba57fa82486e88f42a30d5bd (patch) | |
tree | 6546ba6801d219bab6639c292b5bed07d7bd24f8 /src/main/java/org/traccar/web | |
parent | fa3d072b47be36ba011d6f48a1e3fe39bb5f2f6d (diff) | |
download | traccar-server-b7677cbcc610c775ba57fa82486e88f42a30d5bd.tar.gz traccar-server-b7677cbcc610c775ba57fa82486e88f42a30d5bd.tar.bz2 traccar-server-b7677cbcc610c775ba57fa82486e88f42a30d5bd.zip |
Migrate string keys
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/*"); |