diff options
-rw-r--r-- | default.cfg | 1 | ||||
-rw-r--r-- | src/org/traccar/Server.java | 7 | ||||
-rw-r--r-- | src/org/traccar/http/WebServer.java | 6 |
3 files changed, 13 insertions, 1 deletions
diff --git a/default.cfg b/default.cfg index c9805e191..514de5f1e 100644 --- a/default.cfg +++ b/default.cfg @@ -81,6 +81,7 @@ <!-- Web interface port --> <entry key="http.enable">true</entry> + <!--<entry key="http.address"></entry>--> <entry key="http.port">8082</entry> <entry key="geocoder.enable">true</entry> diff --git a/src/org/traccar/Server.java b/src/org/traccar/Server.java index 2f1c7fce5..184281b84 100644 --- a/src/org/traccar/Server.java +++ b/src/org/traccar/Server.java @@ -100,7 +100,12 @@ public class Server { // Initialize web server if (Boolean.valueOf(properties.getProperty("http.enable"))) { Integer port = Integer.valueOf(properties.getProperty("http.port", "8082")); - webServer = new WebServer(port, dataManager); + String address = properties.getProperty("http.address"); + if (address != null) { + webServer = new WebServer(address, port, dataManager); + } else { + webServer = new WebServer(port, dataManager); + } } } diff --git a/src/org/traccar/http/WebServer.java b/src/org/traccar/http/WebServer.java index 6c79e6421..5dfeabed2 100644 --- a/src/org/traccar/http/WebServer.java +++ b/src/org/traccar/http/WebServer.java @@ -19,6 +19,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; +import java.net.InetSocketAddress; import java.util.Iterator; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -193,6 +194,11 @@ public class WebServer { server.setHandler(new WebHandler(dataManager)); } + public WebServer(String address, Integer port, DataManager dataManager) { + server = new Server(new InetSocketAddress(address, port)); + server.setHandler(new WebHandler(dataManager)); + } + public void start() { try { server.start(); |