### Eclipse Workspace Patch 1.0
#P JSPWiki
Index: src/com/ecyrd/jspwiki/ui/TemplateManager.java
===================================================================
RCS file: /p/cvs/JSPWiki/src/com/ecyrd/jspwiki/ui/TemplateManager.java,v
retrieving revision 1.22
diff -u -r1.22 TemplateManager.java
--- src/com/ecyrd/jspwiki/ui/TemplateManager.java	6 Jan 2008 10:45:29 -0000	1.22
+++ src/com/ecyrd/jspwiki/ui/TemplateManager.java	17 Jan 2008 14:54:52 -0000
@@ -72,14 +72,13 @@
      */
     public static final String RESOURCE_INLINECSS  = "inlinecss";
 
-    /** The default directory for the properties. Value is {@value}. */
-    public static final String DIRECTORY           = "templates";
+    /* The default webapp-relative path to the templates. Value is {@value}. */
+    public static final String TEMPLATES_PATH = "/templates";
 
-    /** The name of the default template.  Value is {@value}. */
+    /** The path to the directory containing the default template. Value is {@value}. */
     public static final String DEFAULT_TEMPLATE    = "default";
 
     /** Name of the file that contains the properties.*/
-
     public static final String PROPERTYFILE        = "template.properties";
 
     /** The name under which the resource includes map is stored in the WikiContext. */
@@ -92,6 +91,8 @@
     /** Requests a HTTP header.  Value is {@value}. */
     public static final String RESOURCE_HTTPHEADER = "httpheader";
 
+    private String m_templatesPath;
+
     /**
      *  Creates a new TemplateManager.  There is typically one manager per engine.
      *
@@ -101,6 +102,8 @@
     public TemplateManager( WikiEngine engine, Properties properties )
     {
         super(engine);
+        
+        m_templatesPath = engine.getBasePath() + TEMPLATES_PATH;
 
         //
         //  Uses the unlimited cache.
@@ -141,7 +144,7 @@
      *  @param name The name of the resource
      *  @return The name of the resource which was found.
      */
-    private static String findResource( ServletContext sContext, String name )
+    private String findResource( ServletContext sContext, String name )
     {
         InputStream is = sContext.getResourceAsStream( name );
 
@@ -178,7 +181,7 @@
      * @param name
      * @return
      */
-    private static String findResource( ServletContext sContext, String template, String name )
+    private String findResource( ServletContext sContext, String template, String name )
     {
         if( name.charAt(0) == '/' )
         {
@@ -232,9 +235,9 @@
      * @param name
      * @return
      */
-    private static final String makeFullJSPName( String template, String name )
+    private final String makeFullJSPName( String template, String name )
     {
-        return "/"+DIRECTORY+"/"+template+"/"+name;
+        return m_templatesPath + "/" + template + "/" + name;
     }
 
     /**
@@ -330,9 +333,9 @@
     /**
      *  Returns an absolute path to a given template.
      */
-    private static final String getPath( String template )
+    private final String getPath( String template )
     {
-        return "/"+DIRECTORY+"/"+template+"/";
+        return m_templatesPath + "/" + template + "/";
     }
 
     /**
