diff options
author | Thomas Lenz <tlenz@iaik.tugraz.at> | 2014-06-11 13:26:08 +0200 |
---|---|---|
committer | Thomas Lenz <tlenz@iaik.tugraz.at> | 2014-06-11 13:26:08 +0200 |
commit | 64ef43d992ffd7cfd5f571b1922ad0d32ef668ad (patch) | |
tree | bc8e99d58d4a5f869973f47dbe13660424a23e07 | |
parent | 1fcd3257660917fef95498f36300330afe8a00ed (diff) | |
download | moa-id-spss-MOA-ID-2.1-RC2.tar.gz moa-id-spss-MOA-ID-2.1-RC2.tar.bz2 moa-id-spss-MOA-ID-2.1-RC2.zip |
solve problem with Velocity EngineMOA-ID-2.1-RC2
-rw-r--r-- | id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/moduls/SSOManager.java | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/moduls/SSOManager.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/moduls/SSOManager.java index a46b11c6e..cb12bc5bd 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/moduls/SSOManager.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/moduls/SSOManager.java @@ -288,21 +288,22 @@ public class SSOManager { public void printSingleLogOutInfo(VelocityContext context, HttpServletResponse httpResp) throws MOAIDException { try { Logger.trace("Initialize VelocityEngine..."); - VelocityEngine velocityEngine = VelocityProvider.getClassPathVelocityEngine(); InputStream is = null; + String pathLocation = null; try { String rootconfigdir = AuthConfigurationProvider.getInstance().getRootConfigFileDir(); - String pathLocation = rootconfigdir + HTMLTEMPLATESDIR + HTMLTEMPLATEFULL; + pathLocation = rootconfigdir + HTMLTEMPLATESDIR + HTMLTEMPLATEFULL; File file = new File(new URI(pathLocation)); is = new FileInputStream(file); evaluateSLOTemplate(context, httpResp, is); } catch (Exception e) { - Logger.warn("SLO Template is not found in configuration directory. Load template from project library ... "); + Logger.warn("SLO Template is not found in configuration directory (" + + pathLocation + "). Load template from project library ... "); try { - String pathLocation = "resources/templates/" + HTMLTEMPLATEFULL; + pathLocation = "resources/templates/" + HTMLTEMPLATEFULL; is = Thread.currentThread() .getContextClassLoader() .getResourceAsStream(pathLocation); @@ -326,7 +327,10 @@ public class SSOManager { } - private void evaluateSLOTemplate(VelocityContext context, HttpServletResponse httpResp, InputStream is) throws ConfigurationException, IOException { + private void evaluateSLOTemplate(VelocityContext context, HttpServletResponse httpResp, InputStream is) throws Exception { + + VelocityEngine engine = VelocityProvider.getClassPathVelocityEngine(); + BufferedReader reader = new BufferedReader(new InputStreamReader(is )); //set default elements to velocity context @@ -334,7 +338,7 @@ public class SSOManager { StringWriter writer = new StringWriter(); //velocityEngine.evaluate(context, writer, "SLO_Template", reader); - Velocity.evaluate(context, writer, "SLO Template", reader); + engine.evaluate(context, writer, "SLO Template", reader); httpResp.setContentType("text/html;charset=UTF-8"); |