aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/web/WebServer.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-02-03 08:07:02 +1300
committerGitHub <noreply@github.com>2018-02-03 08:07:02 +1300
commitc8f3ddf412dc98b9430f697a0e02d24a3f15627d (patch)
tree185d255ed2b6d1069c48cc39f5ef0545e0574626 /src/org/traccar/web/WebServer.java
parentc70fa517c467472e96c1f06729da338ac7a39c9e (diff)
parentbec12783f99849131f80175731d00b3f7929e661 (diff)
downloadtrackermap-server-c8f3ddf412dc98b9430f697a0e02d24a3f15627d.tar.gz
trackermap-server-c8f3ddf412dc98b9430f697a0e02d24a3f15627d.tar.bz2
trackermap-server-c8f3ddf412dc98b9430f697a0e02d24a3f15627d.zip
Merge pull request #3752 from Abyss777/switch_media
Add switch to enable media web access
Diffstat (limited to 'src/org/traccar/web/WebServer.java')
-rw-r--r--src/org/traccar/web/WebServer.java14
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..06894552d 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.hasKey("media.path")) {
+ 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));
+ }
ResourceConfig resourceConfig = new ResourceConfig();
resourceConfig.registerClasses(JacksonFeature.class, ObjectMapperProvider.class, ResourceErrorHandler.class);