diff options
author | Daniel <djr2468@gmail.com> | 2023-04-05 22:27:02 +0100 |
---|---|---|
committer | Daniel <djr2468@gmail.com> | 2023-04-05 22:27:02 +0100 |
commit | c0dd2a6187de517af33aa92e0524414e65d973b4 (patch) | |
tree | 20afcdd6233940a30a4cf8dee6aaa09e6d3fdf21 /src/main/java/org/traccar/MainModule.java | |
parent | a710ddd5ad336cd45d3a0e69f13985db840763dc (diff) | |
download | trackermap-server-c0dd2a6187de517af33aa92e0524414e65d973b4.tar.gz trackermap-server-c0dd2a6187de517af33aa92e0524414e65d973b4.tar.bz2 trackermap-server-c0dd2a6187de517af33aa92e0524414e65d973b4.zip |
Rename ServletHelper to WebHelper
Diffstat (limited to 'src/main/java/org/traccar/MainModule.java')
-rw-r--r-- | src/main/java/org/traccar/MainModule.java | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/src/main/java/org/traccar/MainModule.java b/src/main/java/org/traccar/MainModule.java index 4db6e0e32..41124bd03 100644 --- a/src/main/java/org/traccar/MainModule.java +++ b/src/main/java/org/traccar/MainModule.java @@ -75,6 +75,7 @@ import org.traccar.handler.GeolocationHandler; import org.traccar.handler.SpeedLimitHandler; import org.traccar.helper.ObjectMapperContextResolver; import org.traccar.helper.SanitizerModule; +import org.traccar.helper.WebHelper; import org.traccar.mail.LogMailManager; import org.traccar.mail.MailManager; import org.traccar.mail.SmtpMailManager; @@ -390,19 +391,7 @@ public class MainModule extends AbstractModule { public static VelocityEngine provideVelocityEngine(Config config) { Properties properties = new Properties(); properties.setProperty("resource.loader.file.path", config.getString(Keys.TEMPLATES_ROOT) + "/"); - - if (config.hasKey(Keys.WEB_URL)) { - properties.setProperty("web.url", config.getString(Keys.WEB_URL).replaceAll("/$", "")); - } else { - String address; - try { - address = config.getString(Keys.WEB_ADDRESS, InetAddress.getLocalHost().getHostAddress()); - } catch (UnknownHostException e) { - address = "localhost"; - } - String url = URIUtil.newURI("http", address, config.getInteger(Keys.WEB_PORT), "", ""); - properties.setProperty("web.url", url); - } + properties.setProperty("web.url", WebHelper.retrieveWebUrl(config)); VelocityEngine velocityEngine = new VelocityEngine(); velocityEngine.init(properties); |