From 50ca72b3249bece77434a8d5151577dcd8867697 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Sat, 10 Dec 2016 13:09:45 +0500 Subject: - Use URL builder - Use Curly braces in templates --- src/org/traccar/Context.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/org') diff --git a/src/org/traccar/Context.java b/src/org/traccar/Context.java index 62396d740..2cd1beecc 100644 --- a/src/org/traccar/Context.java +++ b/src/org/traccar/Context.java @@ -21,6 +21,7 @@ import java.net.InetAddress; import java.util.Properties; import org.apache.velocity.app.VelocityEngine; +import org.eclipse.jetty.util.URIUtil; import org.traccar.database.AliasesManager; import org.traccar.database.ConnectionManager; import org.traccar.database.DataManager; @@ -259,8 +260,8 @@ public final class Context { "org.apache.velocity.runtime.log.NullLogChute"); String address = config.getString("web.address", InetAddress.getLocalHost().getHostAddress()); - String port = config.getString("web.port", "8082"); - String webUrl = "http://" + address + ":" + port + "/"; + int port = config.getInteger("web.port", 8082); + String webUrl = URIUtil.newURI("http", address, port, "", ""); webUrl = Context.getConfig().getString("web.url", webUrl); velocityProperties.setProperty("web.url", webUrl); -- cgit v1.2.3