diff options
author | Anton Tananaev <anton@traccar.org> | 2022-06-11 08:28:41 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-06-11 08:28:41 -0700 |
commit | a401b40ee3b69d5679031a1e1d7287a0a56f4160 (patch) | |
tree | 30b0a1dfdc6b396dcb12947f19307b749e531446 /src/main/java/org/traccar/Context.java | |
parent | 5b269c0e309b70866ad167fb148eafcbad5a8b26 (diff) | |
download | trackermap-server-a401b40ee3b69d5679031a1e1d7287a0a56f4160.tar.gz trackermap-server-a401b40ee3b69d5679031a1e1d7287a0a56f4160.tar.bz2 trackermap-server-a401b40ee3b69d5679031a1e1d7287a0a56f4160.zip |
Inject velocity engine
Diffstat (limited to 'src/main/java/org/traccar/Context.java')
-rw-r--r-- | src/main/java/org/traccar/Context.java | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/src/main/java/org/traccar/Context.java b/src/main/java/org/traccar/Context.java index 95ff2eddb..627acd4e2 100644 --- a/src/main/java/org/traccar/Context.java +++ b/src/main/java/org/traccar/Context.java @@ -18,8 +18,6 @@ package org.traccar; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.datatype.jsr353.JSR353Module; -import org.apache.velocity.app.VelocityEngine; -import org.eclipse.jetty.util.URIUtil; import org.traccar.config.Config; import org.traccar.config.Keys; import org.traccar.database.BaseObjectManager; @@ -46,9 +44,6 @@ import org.traccar.session.cache.CacheManager; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.ext.ContextResolver; -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.util.Properties; public final class Context { @@ -115,12 +110,6 @@ public final class Context { return notificationManager; } - private static VelocityEngine velocityEngine; - - public static VelocityEngine getVelocityEngine() { - return velocityEngine; - } - private static Client client = ClientBuilder.newClient(); public static Client getClient() { @@ -185,25 +174,6 @@ public final class Context { Main.getInjector().getInstance(EventForwarder.class), Main.getInjector().getInstance(NotificatorManager.class), Main.getInjector().getInstance(Geocoder.class)); - Properties velocityProperties = new Properties(); - velocityProperties.setProperty("file.resource.loader.path", - Context.getConfig().getString("templates.rootPath", "templates") + "/"); - velocityProperties.setProperty("runtime.log.logsystem.class", - "org.apache.velocity.runtime.log.NullLogChute"); - - String address; - try { - address = config.getString(Keys.WEB_ADDRESS, InetAddress.getLocalHost().getHostAddress()); - } catch (UnknownHostException e) { - address = "localhost"; - } - - String webUrl = URIUtil.newURI("http", address, config.getInteger(Keys.WEB_PORT), "", ""); - webUrl = Context.getConfig().getString("web.url", webUrl); - velocityProperties.setProperty("web.url", webUrl); - - velocityEngine = new VelocityEngine(); - velocityEngine.init(velocityProperties); } public static <T extends BaseModel> BaseObjectManager<T> getManager(Class<T> clazz) { |