portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wea...@apache.org
Subject cvs commit: jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/profiler/impl ProfilerValveImpl.java
Date Fri, 03 Sep 2004 13:26:24 GMT
weaver      2004/09/03 06:26:24

  Modified:    portal/src/java/org/apache/jetspeed/profiler/impl
                        ProfilerValveImpl.java
  Log:
  - Corrected some issues with root folder being an empty string.
  - Made sure pages are correctly prefixed with there parent.
  
  Revision  Changes    Path
  1.11      +26 -15    jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/profiler/impl/ProfilerValveImpl.java
  
  Index: ProfilerValveImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/profiler/impl/ProfilerValveImpl.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ProfilerValveImpl.java	24 Aug 2004 14:26:27 -0000	1.10
  +++ ProfilerValveImpl.java	3 Sep 2004 13:26:24 -0000	1.11
  @@ -22,8 +22,11 @@
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   import org.apache.jetspeed.om.folder.Folder;
  +import org.apache.jetspeed.om.folder.FolderNotFoundException;
  +import org.apache.jetspeed.om.page.Page;
   import org.apache.jetspeed.page.PageManager;
   import org.apache.jetspeed.page.PageNotFoundException;
  +import org.apache.jetspeed.page.document.NodeException;
   import org.apache.jetspeed.pipeline.PipelineException;
   import org.apache.jetspeed.pipeline.valve.AbstractValve;
   import org.apache.jetspeed.pipeline.valve.PageProfilerValve;
  @@ -40,6 +43,7 @@
    */
   public class ProfilerValveImpl extends AbstractValve implements PageProfilerValve
   {
  +    public static final String SLASH = "/";
       protected Log log = LogFactory.getLog(ProfilerValveImpl.class);
       private Profiler profiler;
       static final String LOCATOR_KEY = "org.apache.jetpeed.profileLocator";
  @@ -67,14 +71,14 @@
               ProfileLocator locator = null;
               Folder folder = getFolder(request);
               httpRequest.setAttribute(FOLDER_ATTR_KEY, folder);
  -            request.setPage(pageManager.getPage(getPageName(request, folder)));
  +            request.setPage(folder.getPage(getPageName(request, folder)));
   
               locator = profiler.getProfile(request);
               request.setProfileLocator(locator);
               // request.setPage(profiler.getPage(locator));
               context.invokeNext(request);
   
  -        }       
  +        }
           catch (PageNotFoundException e)
           {
               log.error(e.getMessage(), e);
  @@ -93,8 +97,7 @@
           }
       }
   
  -
  -    protected Folder getFolder( RequestContext request ) throws IOException
  +    protected Folder getFolder( RequestContext request ) throws FolderNotFoundException,
NodeException
       {
           HttpServletRequest httpRequest = request.getRequest();
           String folderInRequest = getFolderPath(request);
  @@ -114,7 +117,7 @@
               selectedFolder = (Folder) httpRequest.getAttribute(FOLDER_ATTR_KEY);
               if (selectedFolder == null)
               {
  -                selectedFolder = pageManager.getFolder("/");
  +                selectedFolder = pageManager.getFolder(SLASH);
               }
           }
   
  @@ -124,21 +127,29 @@
   
       protected String getFolderPath( RequestContext request )
       {
  -        String pathInfo = request.getPath();  
  -        
  +        String pathInfo = request.getPath();
  +
           String folder = null;
           if (pathInfo != null)
           {
  -            if (pathInfo.endsWith(PageManager.PAGE_SUFFIX))
  +            if (pathInfo.endsWith(Page.DOCUMENT_TYPE))
               {
  -                int lastSlash = pathInfo.lastIndexOf("/");
  -                if(lastSlash > -1)
  +                int lastSlash = pathInfo.lastIndexOf(SLASH);
  +                if (lastSlash > -1)
                   {
  -                    return pathInfo.substring(0, lastSlash);
  +                    String folderPath = pathInfo.substring(0, lastSlash);
  +                    if (folderPath.length() > 0)
  +                    {
  +                        return folderPath;
  +                    }
  +                    else
  +                    {
  +                        return SLASH;
  +                    }
                   }
                   else
                   {
  -                    return "/";
  +                    return SLASH;
                   }
               }
               else
  @@ -148,7 +159,7 @@
           }
           else
           {
  -            return "/";
  +            return SLASH;
           }
       }
   
  @@ -163,7 +174,7 @@
           {
               return pathInfo;
           }
  -    }    
  +    }
   
       public String toString()
       {
  
  
  

---------------------------------------------------------------------
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