portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From raph...@apache.org
Subject cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/services/psmlmanager CastorPsmlManagerService.java
Date Wed, 06 Jun 2001 22:27:39 GMT
raphael     01/06/06 15:27:39

  Modified:    src/java/org/apache/jetspeed/services/psmlmanager
                        CastorPsmlManagerService.java
  Log:
  [fix] switch method for monitoring PSML files to depend on getRealPath()
  rather than getResource() to fix issue with Catalina
  
  Revision  Changes    Path
  1.2       +23 -14    jakarta-jetspeed/src/java/org/apache/jetspeed/services/psmlmanager/CastorPsmlManagerService.java
  
  Index: CastorPsmlManagerService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/psmlmanager/CastorPsmlManagerService.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CastorPsmlManagerService.java	2001/06/04 17:30:43	1.1
  +++ CastorPsmlManagerService.java	2001/06/06 22:27:37	1.2
  @@ -67,6 +67,7 @@
   import org.apache.turbine.services.TurbineBaseService;
   import org.apache.turbine.services.InitializationException;
   import org.apache.turbine.services.TurbineServices;
  +import org.apache.turbine.services.servlet.TurbineServlet;
   import org.apache.turbine.services.resources.ResourceService;
   
   //castor support
  @@ -97,7 +98,7 @@
    * This service is responsible for loading and saving PSML documents.
    *
    * @author <a href="mailto:raphael@apache.org">RaphaŽl Luta</a>
  - * @version $Id: CastorPsmlManagerService.java,v 1.1 2001/06/04 17:30:43 raphael Exp $
  + * @version $Id: CastorPsmlManagerService.java,v 1.2 2001/06/06 22:27:37 raphael Exp $
    */
   public class CastorPsmlManagerService extends TurbineBaseService
       implements PsmlManagerService
  @@ -404,22 +405,30 @@
       {
           File f = null;
   
  -        try
  +        f = new File(fileOrUrl);
  +            
  +        if (f.exists())
           {
  -            //FIXME: this will fail for relative URLs, should we
  -            //support them ?
  -            URL url = new URL(fileOrUrl);
  -                
  -            // ok it's an URL, use diskcache and get the file name 
  -            // through the cache
  -                
  -            f = JetspeedDiskCache.getInstance().getEntry(fileOrUrl).getFile();
  -                
  +            return f;
           }
  -        catch (IOException e)
  +        else        
           {
  -            Log.note("PSMLManager: "+fileOrUrl+" is not a URL or not in cache, trying as
file");
  -            f = new File(fileOrUrl);
  +            // try as a relative path
  +            f = new File(TurbineServlet.getRealPath(fileOrUrl));
  +            if (f.exists())
  +            {
  +                return f;
  +            }
  +            
  +            // try through the disk cache
  +            try
  +            {
  +                f = JetspeedDiskCache.getInstance().getEntry(fileOrUrl).getFile();
  +            }
  +            catch (Exception e)
  +            {
  +                Log.error("PSMLManager: unabel to retrieve file from diskcache for "+fileOrUrl,e);
  +            }
           }
           
           return f;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Mime
View raw message