diff options
Diffstat (limited to 'src/org/traccar/web')
-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); |