diff options
author | Abyss777 <abyss@fox5.ru> | 2018-02-02 12:39:22 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2018-02-02 12:39:22 +0500 |
commit | 8f4d1c67d3996657c57ed868f34da4066095480c (patch) | |
tree | a58fb91349a92be73268e6bc2e5b26689a18b34d /src | |
parent | c70fa517c467472e96c1f06729da338ac7a39c9e (diff) | |
download | trackermap-server-8f4d1c67d3996657c57ed868f34da4066095480c.tar.gz trackermap-server-8f4d1c67d3996657c57ed868f34da4066095480c.tar.bz2 trackermap-server-8f4d1c67d3996657c57ed868f34da4066095480c.zip |
Add switch to enable media web access
Diffstat (limited to 'src')
-rw-r--r-- | src/org/traccar/web/WebServer.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/org/traccar/web/WebServer.java b/src/org/traccar/web/WebServer.java index 88b38c1ab..5c3fc8aaa 100644 --- a/src/org/traccar/web/WebServer.java +++ b/src/org/traccar/web/WebServer.java @@ -167,12 +167,14 @@ public class WebServer { servletHandler.addServlet(new ServletHolder(new AsyncSocketServlet()), "/socket"); - ServletHolder servletHolder = new ServletHolder("media", DefaultServlet.class); - servletHolder.setInitParameter("resourceBase", config.getString("media.path")); - servletHolder.setInitParameter("dirAllowed", config.getString("media.directoryAllow", "false")); - servletHolder.setInitParameter("pathInfoOnly", "true"); - servletHandler.addServlet(servletHolder, "/media/*"); - servletHandler.addFilter(MediaFilter.class, "/media/*", EnumSet.allOf(DispatcherType.class)); + if (config.getBoolean("media.web.enable")) { + ServletHolder servletHolder = new ServletHolder("media", DefaultServlet.class); + servletHolder.setInitParameter("resourceBase", config.getString("media.path")); + servletHolder.setInitParameter("dirAllowed", config.getString("media.web.directoryAllow", "false")); + servletHolder.setInitParameter("pathInfoOnly", "true"); + servletHandler.addServlet(servletHolder, "/media/*"); + servletHandler.addFilter(MediaFilter.class, "/media/*", EnumSet.allOf(DispatcherType.class)); + } ResourceConfig resourceConfig = new ResourceConfig(); resourceConfig.registerClasses(JacksonFeature.class, ObjectMapperProvider.class, ResourceErrorHandler.class); |