weaver      2004/01/12 10:19:58

  Modified:    cps/src/java/org/apache/jetspeed/cps/template
                        TemplateLocatorServiceImpl.java
  Log:
  Template now supports and application relative path that can be used
  effectively with Servlet and Portlet request dispatchers
  
  Revision  Changes    Path
  1.2       +8 -3      
jakarta-jetspeed-2/cps/src/java/org/apache/jetspeed/cps/template/TemplateLocatorServiceImpl.java
  
  Index: TemplateLocatorServiceImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/cps/src/java/org/apache/jetspeed/cps/template/TemplateLocatorServiceImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TemplateLocatorServiceImpl.java   28 Jul 2003 23:46:44 -0000      1.1
  +++ TemplateLocatorServiceImpl.java   12 Jan 2004 18:19:58 -0000      1.2
  @@ -181,7 +181,7 @@
                                   + " returning "
                                   + workingPath);
                   }
  -                return createTemplateFromPath(path, templateName, realPath);
  +                return createTemplateFromPath(path, templateName, realPath, root + 
workingPath);
               }
               // else strip path of one of its components and loop
               int pt = path.lastIndexOf(PATH_SEPARATOR);
  @@ -266,10 +266,15 @@
        * @param realPath the real path on the file system
        * @return newly created Template
        */
  -    private Template createTemplateFromPath(String path, String name, String 
realPath)
  +    private Template createTemplateFromPath(String path, String name, String 
realPath, String relativePath)
       {    
           TemplateImpl template = new TemplateImpl();
           template.setAbsolutePath(realPath);
  +        if(relativePath.indexOf("/") != 0)
  +        {
  +                     relativePath = "/"+relativePath;
  +        }
  +        template.setAppRelativePath(relativePath);
           template.setName(name);            
           StringTokenizer tok = new StringTokenizer(path, "/");
           int count = 0;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to