aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/web
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2019-02-02 13:33:01 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2019-02-02 13:33:01 -0800
commit56651897dc77998ddeda400a9ffee2e018e44dd0 (patch)
treead284463796c12bf59c8ed445cb3901bcb2c9b5d /src/org/traccar/web
parentd16a4171a61cf8af5088a1aca9476aa7a44a2441 (diff)
downloadtrackermap-server-56651897dc77998ddeda400a9ffee2e018e44dd0.tar.gz
trackermap-server-56651897dc77998ddeda400a9ffee2e018e44dd0.tar.bz2
trackermap-server-56651897dc77998ddeda400a9ffee2e018e44dd0.zip
Use full paths for web
Diffstat (limited to 'src/org/traccar/web')
-rw-r--r--src/org/traccar/web/WebServer.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/org/traccar/web/WebServer.java b/src/org/traccar/web/WebServer.java
index c657f9aec..13a5a4238 100644
--- a/src/org/traccar/web/WebServer.java
+++ b/src/org/traccar/web/WebServer.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2012 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,6 +43,7 @@ import javax.servlet.DispatcherType;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import java.io.File;
import java.io.IOException;
import java.io.Writer;
import java.net.InetSocketAddress;
@@ -121,7 +122,7 @@ public class WebServer {
private void initWebApp(Config config, ServletContextHandler servletHandler) {
ServletHolder servletHolder = new ServletHolder(DefaultServlet.class);
- servletHolder.setInitParameter("resourceBase", config.getString("web.path"));
+ servletHolder.setInitParameter("resourceBase", new File(config.getString("web.path")).getAbsolutePath());
if (config.getBoolean("web.debug")) {
servletHandler.setWelcomeFiles(new String[] {"debug.html", "index.html"});
} else {
@@ -139,7 +140,7 @@ public class WebServer {
if (config.hasKey("media.path")) {
ServletHolder servletHolder = new ServletHolder(DefaultServlet.class);
- servletHolder.setInitParameter("resourceBase", config.getString("media.path"));
+ servletHolder.setInitParameter("resourceBase", new File(config.getString("media.path")).getAbsolutePath());
servletHolder.setInitParameter("dirAllowed", config.getString("media.dirAllowed", "false"));
servletHolder.setInitParameter("pathInfoOnly", "true");
servletHandler.addServlet(servletHolder, "/api/media/*");