Author: thomas.heute(a)jboss.com
Date: 2007-03-24 05:38:38 -0400 (Sat, 24 Mar 2007)
New Revision: 6815
Modified:
trunk/build/build-thirdparty.xml
trunk/core/build.xml
trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java
Log:
Put back freemarker
Modified: trunk/build/build-thirdparty.xml
===================================================================
--- trunk/build/build-thirdparty.xml 2007-03-24 01:24:32 UTC (rev 6814)
+++ trunk/build/build-thirdparty.xml 2007-03-24 09:38:38 UTC (rev 6815)
@@ -108,9 +108,7 @@
<componentref name="sun-servlet" version="2.4"/>
<componentref name="xdoclet" version="1.2.3"/>
<componentref name="jbpm/jaronly" version="3.1.2"/>
-<!--
<componentref name="freemarker" version="2.3.9"/>
--->
<componentref name="wutka-dtdparser" version="1.2.1"/>
</build>
Modified: trunk/core/build.xml
===================================================================
--- trunk/core/build.xml 2007-03-24 01:24:32 UTC (rev 6814)
+++ trunk/core/build.xml 2007-03-24 09:38:38 UTC (rev 6815)
@@ -91,7 +91,7 @@
<path refid="jboss.cache.classpath"/>
<path refid="jbossas/core.libs.classpath"/>
<path refid="hibernate.hibernate.classpath"/>
- <!--<path refid="freemarker.freemarker.classpath"/>-->
+ <path refid="freemarker.freemarker.classpath"/>
<path refid="apache.ant.classpath"/>
<path refid="apache.myfaces.classpath"/>
<path refid="apache.log4j.classpath"/>
Modified: trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java 2007-03-24
01:24:32 UTC (rev 6814)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java 2007-03-24
09:38:38 UTC (rev 6815)
@@ -73,9 +73,9 @@
import org.jboss.portlet.JBossRenderRequest;
import org.jboss.portlet.JBossRenderResponse;
-//import freemarker.template.Configuration;
-//import freemarker.template.Template;
-//import freemarker.template.TemplateException;
+import freemarker.template.Configuration;
+import freemarker.template.Template;
+import freemarker.template.TemplateException;
/**
* This portlet aims at managing users
@@ -1077,7 +1077,8 @@
ClassLoader tcl = Thread.currentThread().getContextClassLoader();
String message = null;
- try {
+ try
+ {
Locale locale = req.getLocale();
URL config = tcl.getResource("templates/user/emailTemplate_" +
locale.getLanguage() + "_" + locale.getCountry()+ ".tpl");
if (config == null)
@@ -1092,23 +1093,23 @@
{
throw new FileNotFoundException("Cannot load a suitable
emailTemplate.tpl in templates/user");
}
-// InputStream in = config.openStream();
-// Template tpl = new Template("emailTemplate", new
InputStreamReader(in), new Configuration());
-// StringWriter out = new StringWriter();
-// tpl.process(modelRoot, out);
-// out.close();
-// message = out.toString();
+ InputStream in = config.openStream();
+ Template tpl = new Template("emailTemplate", new
InputStreamReader(in), new Configuration());
+ StringWriter out = new StringWriter();
+ tpl.process(modelRoot, out);
+ out.close();
+ message = out.toString();
}
catch (IOException e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
}
-// catch (TemplateException e)
-// {
-// // TODO Auto-generated catch block
-// e.printStackTrace();
-// }
+ catch (TemplateException e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
return message;
}