diff options
author | Thomas Lenz <tlenz@iaik.tugraz.at> | 2017-01-30 15:24:37 +0100 |
---|---|---|
committer | Thomas Lenz <tlenz@iaik.tugraz.at> | 2017-01-30 15:24:37 +0100 |
commit | 993209bc08a4cf6f9600a93607cd137bdc48bb2e (patch) | |
tree | 158b5f3067f78e4c3886e65a0286c0f6d49d4abc /id/server/moa-id-frontend-resources/src/main/java/at | |
parent | 907529e196ca850df270cd9da80900a08219b2c6 (diff) | |
download | moa-id-spss-993209bc08a4cf6f9600a93607cd137bdc48bb2e.tar.gz moa-id-spss-993209bc08a4cf6f9600a93607cd137bdc48bb2e.tar.bz2 moa-id-spss-993209bc08a4cf6f9600a93607cd137bdc48bb2e.zip |
small change in VelocityProvider
Diffstat (limited to 'id/server/moa-id-frontend-resources/src/main/java/at')
-rw-r--r-- | id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/velocity/VelocityProvider.java | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/velocity/VelocityProvider.java b/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/velocity/VelocityProvider.java index 21fe110ca..015d8e321 100644 --- a/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/velocity/VelocityProvider.java +++ b/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/velocity/VelocityProvider.java @@ -62,19 +62,22 @@ import org.apache.velocity.runtime.RuntimeConstants; */
public class VelocityProvider {
+ private static VelocityEngine velocityEngine = null;
+
/**
* Gets velocityEngine from Classpath
* @return VelocityEngine
* @throws Exception
*/
public static VelocityEngine getClassPathVelocityEngine() throws Exception {
- VelocityEngine velocityEngine = getBaseVelocityEngine();
- velocityEngine.setProperty(RuntimeConstants.RESOURCE_LOADER, "classpath");
- velocityEngine.setProperty("classpath.resource.loader.class",
- "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
-
-
- velocityEngine.init();
+ if (velocityEngine == null) {
+ velocityEngine = getBaseVelocityEngine();
+ velocityEngine.setProperty(RuntimeConstants.RESOURCE_LOADER, "classpath");
+ velocityEngine.setProperty("classpath.resource.loader.class",
+ "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
+ velocityEngine.init();
+
+ }
return velocityEngine;
}
@@ -86,13 +89,16 @@ public class VelocityProvider { * @throws Exception
*/
public static VelocityEngine getFileVelocityEngine(String rootPath) throws Exception {
- VelocityEngine velocityEngine = getBaseVelocityEngine();
- velocityEngine.setProperty(RuntimeConstants.RESOURCE_LOADER, "file");
- velocityEngine.setProperty("file.resource.loader.class",
- "org.apache.velocity.runtime.resource.loader.FileResourceLoader");
- velocityEngine.setProperty("file.resource.loader.path", rootPath);
+ if (velocityEngine == null) {
+ velocityEngine = getBaseVelocityEngine();
+ velocityEngine.setProperty(RuntimeConstants.RESOURCE_LOADER, "file");
+ velocityEngine.setProperty("file.resource.loader.class",
+ "org.apache.velocity.runtime.resource.loader.FileResourceLoader");
+ velocityEngine.setProperty("file.resource.loader.path", rootPath);
- velocityEngine.init();
+ velocityEngine.init();
+
+ }
return velocityEngine;
}
|