geirm 01/04/27 08:22:20
Modified: src/java/org/apache/velocity/runtime Runtime.java
Log:
Added new method and delegation to call through to ResourceManager. Needed
to support a side-effect-free implementation of Velocity.templateExists()
Revision Changes Path
1.109 +16 -1
jakarta-velocity/src/java/org/apache/velocity/runtime/Runtime.java
Index: Runtime.java
===================================================================
RCS file:
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/Runtime.java,v
retrieving revision 1.108
retrieving revision 1.109
diff -u -r1.108 -r1.109
--- Runtime.java 2001/04/22 18:17:42 1.108
+++ Runtime.java 2001/04/27 15:22:16 1.109
@@ -141,7 +141,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Jeff Bowden</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Geir Magusson Jr.</a>
- * @version $Id: Runtime.java,v 1.108 2001/04/22 18:17:42 geirm Exp $
+ * @version $Id: Runtime.java,v 1.109 2001/04/27 15:22:16 geirm Exp $
*/
public class Runtime implements RuntimeConstants
{
@@ -723,6 +723,21 @@
{
return (ContentResource) ResourceManager
.getResource(name,ResourceManager.RESOURCE_CONTENT, encoding );
+ }
+
+
+ /**
+ * Determines is a template exists, and returns name of the loader that
+ * provides it. This is a slightly less hokey way to support
+ * the Velocity.templateExists() utility method, which was broken
+ * when per-template encoding was introduced. We can revisit this.
+ *
+ * @param resourceName Name of template or content resource
+ * @return class name of loader than can provide it
+ */
+ public static String getLoaderNameForResource( String resourceName )
+ {
+ return ResourceManager.getLoaderNameForResource( resourceName );
}
/**