geirm 01/04/23 05:01:13
Modified: src/java/org/apache/velocity/app Velocity.java
Log:
Update to mergeTemplate() to also support per-encoding
Revision Changes Path
1.14 +24 -2 jakarta-velocity/src/java/org/apache/velocity/app/Velocity.java
Index: Velocity.java
===================================================================
RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/app/Velocity.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- Velocity.java 2001/04/22 23:02:02 1.13
+++ Velocity.java 2001/04/23 12:01:13 1.14
@@ -107,7 +107,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
* @author <a href="[EMAIL PROTECTED]">Christoph Reck</a>
* @author <a href="[EMAIL PROTECTED]">Jason van Zyl</a>
- * @version $Id: Velocity.java,v 1.13 2001/04/22 23:02:02 geirm Exp $
+ * @version $Id: Velocity.java,v 1.14 2001/04/23 12:01:13 geirm Exp $
*/
public class Velocity implements RuntimeConstants
@@ -464,12 +464,34 @@
*
* @return true if successful, false otherwise. Errors
* logged to velocity log.
+ * * @deprecated Use
+ * {@link #mergeTemplate( String templateName, String encoding,
+ * Context context, Writer writer )}
*/
public static boolean mergeTemplate( String templateName,
Context context, Writer writer )
throws ResourceNotFoundException, ParseErrorException,
MethodInvocationException, Exception
{
- Template template = Runtime.getTemplate(templateName);
+ return mergeTemplate( templateName,
Runtime.getString(INPUT_ENCODING,ENCODING_DEFAULT),
+ context, writer );
+ }
+
+ /**
+ * merges a template and puts the rendered stream into the writer
+ *
+ * @param templateName name of template to be used in merge
+ * @param encoding encoding used in template
+ * @param context filled context to be used in merge
+ * @param writer writer to write template into
+ *
+ * @return true if successful, false otherwise. Errors
+ * logged to velocity log
+ */
+ public static boolean mergeTemplate( String templateName, String encoding,
+ Context context, Writer writer )
+ throws ResourceNotFoundException, ParseErrorException,
MethodInvocationException, Exception
+ {
+ Template template = Runtime.getTemplate(templateName, encoding);
if ( template == null )
{