diff options
author | Abyss777 <abyss@fox5.ru> | 2016-12-10 13:09:45 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2016-12-10 13:09:45 +0500 |
commit | 50ca72b3249bece77434a8d5151577dcd8867697 (patch) | |
tree | 889fc63b04191a5e0af129c14c09579fb761b1e9 | |
parent | 17dc43290bb821c77eaaf196e4c6fef4d5c1a343 (diff) | |
download | trackermap-server-50ca72b3249bece77434a8d5151577dcd8867697.tar.gz trackermap-server-50ca72b3249bece77434a8d5151577dcd8867697.tar.bz2 trackermap-server-50ca72b3249bece77434a8d5151577dcd8867697.zip |
- Use URL builder
- Use Curly braces in templates
-rw-r--r-- | src/org/traccar/Context.java | 5 | ||||
-rw-r--r-- | templates/mail/alarm.vm | 2 | ||||
-rw-r--r-- | templates/mail/deviceMoving.vm | 2 | ||||
-rw-r--r-- | templates/mail/deviceOverspeed.vm | 2 | ||||
-rw-r--r-- | templates/mail/deviceStopped.vm | 2 | ||||
-rw-r--r-- | templates/mail/geofenceEnter.vm | 2 | ||||
-rw-r--r-- | templates/mail/geofenceExit.vm | 2 | ||||
-rw-r--r-- | templates/mail/ignitionOff.vm | 2 | ||||
-rw-r--r-- | templates/mail/ignitionOn.vm | 2 | ||||
-rw-r--r-- | templates/mail/maintenance.vm | 2 |
10 files changed, 12 insertions, 11 deletions
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); diff --git a/templates/mail/alarm.vm b/templates/mail/alarm.vm index 03cd31646..1d2b4fdf8 100644 --- a/templates/mail/alarm.vm +++ b/templates/mail/alarm.vm @@ -5,6 +5,6 @@ Device: $device.name<br> Alarm: $position.getString("alarm")<br> Time: $event.serverTime<br> -Point: <a href="$webUrl?eventId=$event.id">#if($position.address)$position.address#{else}$position.latitude°, $position.longitude°#end</a><br> +Point: <a href="$webUrl?eventId=$event.id">#{if}($position.address)$position.address#{else}$position.latitude°, $position.longitude°#{end}</a><br> </body> </html> diff --git a/templates/mail/deviceMoving.vm b/templates/mail/deviceMoving.vm index c603f8222..a946753e4 100644 --- a/templates/mail/deviceMoving.vm +++ b/templates/mail/deviceMoving.vm @@ -5,6 +5,6 @@ Device: $device.name<br> Moving<br> Time: $event.serverTime<br> -Point: <a href="$webUrl?eventId=$event.id">#if($position.address)$position.address#{else}$position.latitude°, $position.longitude°#end</a><br> +Point: <a href="$webUrl?eventId=$event.id">#{if}($position.address)$position.address#{else}$position.latitude°, $position.longitude°#{end}</a><br> </body> </html> diff --git a/templates/mail/deviceOverspeed.vm b/templates/mail/deviceOverspeed.vm index 27cf1f704..7b99c6a06 100644 --- a/templates/mail/deviceOverspeed.vm +++ b/templates/mail/deviceOverspeed.vm @@ -12,6 +12,6 @@ Device: $device.name<br> Exceeds the speed: $speedString<br> Time: $event.serverTime<br> -Point: <a href="$webUrl?eventId=$event.id">#if($position.address)$position.address#{else}$position.latitude°, $position.longitude°#end</a><br> +Point: <a href="$webUrl?eventId=$event.id">#{if}($position.address)$position.address#{else}$position.latitude°, $position.longitude°#{end}</a><br> </body> </html> diff --git a/templates/mail/deviceStopped.vm b/templates/mail/deviceStopped.vm index a831b9abb..c36e6f1b6 100644 --- a/templates/mail/deviceStopped.vm +++ b/templates/mail/deviceStopped.vm @@ -5,6 +5,6 @@ Device: $device.name<br> Stopped<br> Time: $event.serverTime<br> -Point: <a href="$webUrl?eventId=$event.id">#if($position.address)$position.address#{else}$position.latitude°, $position.longitude°#end</a><br> +Point: <a href="$webUrl?eventId=$event.id">#{if}($position.address)$position.address#{else}$position.latitude°, $position.longitude°#{end}</a><br> </body> </html> diff --git a/templates/mail/geofenceEnter.vm b/templates/mail/geofenceEnter.vm index 2cdd24ee4..cef24723a 100644 --- a/templates/mail/geofenceEnter.vm +++ b/templates/mail/geofenceEnter.vm @@ -5,6 +5,6 @@ Device: $device.name<br> Has entered geofence: $geofence.name<br> Time: $event.serverTime<br> -Point: <a href="$webUrl?eventId=$event.id">#if($position.address)$position.address#{else}$position.latitude°, $position.longitude°#end</a><br> +Point: <a href="$webUrl?eventId=$event.id">#{if}($position.address)$position.address#{else}$position.latitude°, $position.longitude°#{end}</a><br> </body> </html> diff --git a/templates/mail/geofenceExit.vm b/templates/mail/geofenceExit.vm index d1a717159..e696e6556 100644 --- a/templates/mail/geofenceExit.vm +++ b/templates/mail/geofenceExit.vm @@ -5,6 +5,6 @@ Device: $device.name<br> Has exited geofence: $geofence.name<br> Time: $event.serverTime<br> -Point: <a href="$webUrl?eventId=$event.id">#if($position.address)$position.address#{else}$position.latitude°, $position.longitude°#end</a><br> +Point: <a href="$webUrl?eventId=$event.id">#{if}($position.address)$position.address#{else}$position.latitude°, $position.longitude°#{end}</a><br> </body> </html> diff --git a/templates/mail/ignitionOff.vm b/templates/mail/ignitionOff.vm index 9985d4ff3..229405cca 100644 --- a/templates/mail/ignitionOff.vm +++ b/templates/mail/ignitionOff.vm @@ -5,6 +5,6 @@ Device: $device.name<br> Ignition OFF<br> Time: $event.serverTime<br> -Point: <a href="$webUrl?eventId=$event.id">#if($position.address)$position.address#{else}$position.latitude°, $position.longitude°#end</a><br> +Point: <a href="$webUrl?eventId=$event.id">#{if}($position.address)$position.address#{else}$position.latitude°, $position.longitude°#{end}</a><br> </body> </html> diff --git a/templates/mail/ignitionOn.vm b/templates/mail/ignitionOn.vm index 20211ce00..2aeea0132 100644 --- a/templates/mail/ignitionOn.vm +++ b/templates/mail/ignitionOn.vm @@ -5,6 +5,6 @@ Device: $device.name<br> Ignition ON<br> Time: $event.serverTime<br> -Point: <a href="$webUrl?eventId=$event.id">#if($position.address)$position.address#{else}$position.latitude°, $position.longitude°#end</a><br> +Point: <a href="$webUrl?eventId=$event.id">#{if}($position.address)$position.address#{else}$position.latitude°, $position.longitude°#{end}</a><br> </body> </html> diff --git a/templates/mail/maintenance.vm b/templates/mail/maintenance.vm index 7a9d32fa7..4184d138f 100644 --- a/templates/mail/maintenance.vm +++ b/templates/mail/maintenance.vm @@ -5,6 +5,6 @@ Device: $device.name<br> Maintenance is required<br> Time: $event.serverTime<br> -Point: <a href="$webUrl?eventId=$event.id">#if($position.address)$position.address#{else}$position.latitude°, $position.longitude°#end</a><br> +Point: <a href="$webUrl?eventId=$event.id">#{if}($position.address)$position.address#{else}$position.latitude°, $position.longitude°#{end}</a><br> </body> </html> |