portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwat...@apache.org
Subject svn commit: r903419 - in /portals/jetspeed-2/portal/trunk: components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/impl/ components/jetspeed-portal-site/src/test/java/JETSPEED-INF/spring/ components/jetspeed-portal-site/src/test/ja...
Date Tue, 26 Jan 2010 21:09:04 GMT
Author: rwatler
Date: Tue Jan 26 21:09:02 2010
New Revision: 903419

URL: http://svn.apache.org/viewvc?rev=903419&view=rev
Log:
PortalSiteContentMapper enhancements to add system PSML and external content path mappings:
see components/jetspeed-portal-site/src/test/java/JETSPEED-INF/spring/test-spring.xml

Modified:
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/impl/PortalSiteContentTypeMapperImpl.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/impl/PortalSiteRequestContextImpl.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/impl/PortalSiteSessionContextImpl.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/test/java/JETSPEED-INF/spring/test-spring.xml
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/test/java/org/apache/jetspeed/portalsite/TestPortalSite.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/profiler/impl/ProfilerValveImpl.java
    portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/PortalReservedParameters.java
    portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/portalsite/PortalSiteContentTypeMapper.java
    portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/portalsite/PortalSiteRequestContext.java

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/impl/PortalSiteContentTypeMapperImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/impl/PortalSiteContentTypeMapperImpl.java?rev=903419&r1=903418&r2=903419&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/impl/PortalSiteContentTypeMapperImpl.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/impl/PortalSiteContentTypeMapperImpl.java
Tue Jan 26 21:09:02 2010
@@ -17,7 +17,9 @@
     public static final String DEFAULT_PAGE_SYSTEM_TYPE_SUFFIX = Page.DOCUMENT_TYPE;
 
     private List<ContentTypeMapping> contentTypeMappings;
-    private List<RequestPathMapping> requestPathMappings;
+    private List<RequestPathMapping> systemRequestPathMappings;
+    private List<RequestPathMapping> dynamicRequestPathMappings;
+    private List<RequestPathMapping> contentRequestPathMappings;
     private boolean enableContentTypeFallback;
     
     /**
@@ -35,7 +37,7 @@
      */
     public PortalSiteContentTypeMapperImpl(List<ContentTypeMapping> contentTypeMappings)
     {
-        this(contentTypeMappings, null, false);
+        this(contentTypeMappings, null, null, null, false);
     }
 
     /**
@@ -47,34 +49,54 @@
      */
     public PortalSiteContentTypeMapperImpl(List<ContentTypeMapping> contentTypeMappings,
boolean enableContentTypeFallback)
     {
-        this(contentTypeMappings, null, enableContentTypeFallback);
+        this(contentTypeMappings, null, null, null, enableContentTypeFallback);
     }
 
     /**
      * Construct default PortalSite content type mapper implementation.
      * 
      * @param contentTypeMappings mappings to determine content type from request path
-     * @param requestPathMappings mappings to determine request path from server name,
+     * @param dynamicPathMappings mappings to determine dynamic page path from server name,
      *                            content type, and request path
      */
-    public PortalSiteContentTypeMapperImpl(List<ContentTypeMapping> contentTypeMappings,
List<RequestPathMapping> requestPathMappings)
+    public PortalSiteContentTypeMapperImpl(List<ContentTypeMapping> contentTypeMappings,
List<RequestPathMapping> dynamicPathMappings)
     {        
-        this(contentTypeMappings, requestPathMappings, false);
+        this(contentTypeMappings, dynamicPathMappings, null, null, false);
     }
 
     /**
      * Construct default PortalSite content type mapper implementation.
      * 
      * @param contentTypeMappings mappings to determine content type from request path
-     * @param requestPathMappings mappings to determine request path from server name,
+     * @param dynamicPathMappings mappings to determine dynamic page path from server name,
      *                            content type, and request path
      * @param enableContentTypeFallback enable content type fallback for missing system
      *                                  type page, folder, etc. requests
      */
-    public PortalSiteContentTypeMapperImpl(List<ContentTypeMapping> contentTypeMappings,
List<RequestPathMapping> requestPathMappings, boolean enableContentTypeFallback)
+    public PortalSiteContentTypeMapperImpl(List<ContentTypeMapping> contentTypeMappings,
List<RequestPathMapping> dynamicPathMappings, boolean enableContentTypeFallback)
+    {        
+        this(contentTypeMappings, dynamicPathMappings, null, null, enableContentTypeFallback);
+    }
+
+    /**
+     * Construct default PortalSite content type mapper implementation.
+     * 
+     * @param contentTypeMappings mappings to determine content type from request path
+     * @param dynamicPathMappings mappings to determine dynamic page path from server name,
+     *                            content type, and request path
+     * @param systemPathMappings mappings to determine system page path from server name,
+     *                           content type, and request path
+     * @param contentPathMappings mappings to determine external content path from server
+     *                            name, content type, and request path
+     * @param enableContentTypeFallback enable content type fallback for missing system
+     *                                  type page, folder, etc. requests
+     */
+    public PortalSiteContentTypeMapperImpl(List<ContentTypeMapping> contentTypeMappings,
List<RequestPathMapping> dynamicPathMappings, List<RequestPathMapping> systemPathMappings,
List<RequestPathMapping> contentPathMappings, boolean enableContentTypeFallback)
     {        
         this.contentTypeMappings = contentTypeMappings;
-        this.requestPathMappings = requestPathMappings;
+        this.dynamicRequestPathMappings = dynamicPathMappings;
+        this.systemRequestPathMappings = systemPathMappings;
+        this.contentRequestPathMappings = contentPathMappings;
         this.enableContentTypeFallback = enableContentTypeFallback;
     }
 
@@ -107,9 +129,52 @@
     }
 
     /* (non-Javadoc)
-     * @see org.apache.jetspeed.portalsite.PortalSiteContentTypeMapper#mapRequestPath(java.lang.String,
java.lang.String, java.lang.String)
+     * @see org.apache.jetspeed.portalsite.PortalSiteContentTypeMapper#mapSystemRequestPath(java.lang.String,
java.lang.String, java.lang.String)
      */
-    public String mapRequestPath(String serverName, String contentType, String requestPath)
+    public String mapSystemRequestPath(String serverName, String contentType, String requestPath)
+    {
+        return mapRequestPath(systemRequestPathMappings, serverName, contentType, requestPath);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.portalsite.PortalSiteContentTypeMapper#mapDynamicRequestPath(java.lang.String,
java.lang.String, java.lang.String)
+     */
+    public String mapDynamicRequestPath(String serverName, String contentType, String requestPath)
+    {
+        return mapRequestPath(dynamicRequestPathMappings, serverName, contentType, requestPath);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.portalsite.PortalSiteContentTypeMapper#mapContentRequestPath(java.lang.String,
java.lang.String, java.lang.String)
+     */
+    public String mapContentRequestPath(String serverName, String contentType, String requestPath)
+    {
+        return mapRequestPath(contentRequestPathMappings, serverName, contentType, requestPath);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.portalsite.PortalSiteContentTypeMapper#mapSystemType(java.lang.String)
+     */
+    public String mapSystemType(String requestPath)
+    {
+        // match request path suffixes to determine page requests
+        if (requestPath.endsWith(DEFAULT_PAGE_SYSTEM_TYPE_SUFFIX))
+        {
+            return PAGE_SYSTEM_TYPE;
+        }
+        return null;
+    }
+
+    /**
+     * Map content request path using request path mappings.
+     * 
+     * @param requestPathMappings mappings
+     * @param serverName server name
+     * @param contentType mapped content type
+     * @param requestPath original request path
+     * @return mapped path
+     */
+    private String mapRequestPath(List<RequestPathMapping> requestPathMappings, String
serverName, String contentType, String requestPath)
     {
         if (requestPathMappings != null)
         {
@@ -130,17 +195,4 @@
         }
         return null;
     }
-
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.portalsite.PortalSiteContentTypeMapper#mapSystemType(java.lang.String)
-     */
-    public String mapSystemType(String requestPath)
-    {
-        // match request path suffixes to determine page requests
-        if (requestPath.endsWith(DEFAULT_PAGE_SYSTEM_TYPE_SUFFIX))
-        {
-            return PAGE_SYSTEM_TYPE;
-        }
-        return null;
-    }
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/impl/PortalSiteRequestContextImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/impl/PortalSiteRequestContextImpl.java?rev=903419&r1=903418&r2=903419&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/impl/PortalSiteRequestContextImpl.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/impl/PortalSiteRequestContextImpl.java
Tue Jan 26 21:09:02 2010
@@ -83,6 +83,11 @@
     private BaseConcretePageElement requestPage;
     
     /**
+     * requestPageContentPath - cached content path mapped for request page
+     */
+    private String requestPageContentPath;
+    
+    /**
      * requestPageTemplate - cached request page template proxy
      */
     private PageTemplate requestPageTemplate;
@@ -312,17 +317,34 @@
      */
     public BaseConcretePageElement getPage() throws NodeNotFoundException
     {
-        // select request page from session context using
-        // request profile locators if not previously
-        // cached in this context
+        // select request page and associated content path from
+        // session context using request profile locators if not
+        // previously cached in this context
         if (requestPage == null)
         {
-            requestPage = sessionContext.selectRequestPage(requestProfileLocators, requestFallback,
useHistory, forceReservedVisible);            
+            String [] selectedRequestPageContentPath = new String[]{null};
+            requestPage = sessionContext.selectRequestPage(requestProfileLocators, requestFallback,
useHistory, forceReservedVisible, selectedRequestPageContentPath);
+            if (requestPage != null)
+            {
+                requestPageContentPath = selectedRequestPageContentPath[0];
+            }
         }
         return requestPage;
     }
 
     /**
+     * getPageContentPath - get content path associated with request page
+     *  
+     * @return content path
+     * @throws NodeNotFoundException if page not found
+     * @throws SecurityException if page view access not granted
+     */
+    public String getPageContentPath() throws NodeNotFoundException
+    {
+        return ((getPage() != null) ? requestPageContentPath : null);
+    }
+
+    /**
      * getPageTemplate - get page template proxy for request profiled page
      *  
      * @return page template proxy if found or null

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/impl/PortalSiteSessionContextImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/impl/PortalSiteSessionContextImpl.java?rev=903419&r1=903418&r2=903419&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/impl/PortalSiteSessionContextImpl.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/main/java/org/apache/jetspeed/portalsite/impl/PortalSiteSessionContextImpl.java
Tue Jan 26 21:09:02 2010
@@ -219,11 +219,12 @@
      * @param useHistory flag indicating whether to use visited page
      *                   history to select default page per site folder
      * @param forceReservedVisible force reserved/hidden folders visible for request
+     * @param requestPageContentPath returned content path associated with selected page
      * @return selected page proxy for request
      * @throws NodeNotFoundException if not found
      * @throws SecurityException if view access not granted
      */
-    public BaseConcretePageElement selectRequestPage(Map requestProfileLocators, boolean
requestFallback, boolean useHistory, boolean forceReservedVisible) throws NodeNotFoundException
+    public BaseConcretePageElement selectRequestPage(Map requestProfileLocators, boolean
requestFallback, boolean useHistory, boolean forceReservedVisible, String [] requestPageContentPath)
throws NodeNotFoundException
     {
         // validate and update session profile locators if modified
         if (updateSessionProfileLocators(requestProfileLocators, forceReservedVisible))
@@ -296,25 +297,79 @@
                         {
                             log.debug("Content request: requestPath="+requestPath+", mapped
to content type: "+contentType);
                         }
-
-                        // support request path mapping of content requests
-                        String mappedRequestPath = contentTypeMapper.mapRequestPath(requestServerName,
contentType, requestPath);
-                        if (mappedRequestPath != null)
+                        
+                        // generate external content path if mapping defined
+                        String contentPageRequestPath = contentTypeMapper.mapContentRequestPath(requestServerName,
contentType, requestPath);
+                        if (contentPageRequestPath != null)
                         {
                             // log mapping
                             if (log.isDebugEnabled())
                             {
-                                log.debug("Mapped content request: serverName="+requestServerName+",
contentType="+contentType+", requestPath="+requestPath+", mapped to: "+mappedRequestPath);
+                                log.debug("Mapped content request to content path: serverName="+requestServerName+",
contentType="+contentType+", requestPath="+requestPath+", mapped to: "+contentPageRequestPath);
+                            }
+                            
+                            if (requestPageContentPath != null)
+                            {
+                                requestPageContentPath[0] = contentPageRequestPath;
                             }
-                            requestPath = mappedRequestPath;
                         }
 
-                        // attempt to match content request against dynamic pages
-                        // using profile locators and site view; start at root
-                        // folder until path no longer matches and search from
-                        // there back up toward the root for dynamic pages by
-                        // content type; fallback to wildcard content type
-                        return selectContentRequestPage(requestPath, contentType);
+                        // support request path mapping of system page requests
+                        String systemPageRequestPath = contentTypeMapper.mapSystemRequestPath(requestServerName,
contentType, requestPath);
+                        if (systemPageRequestPath != null)
+                        {
+                            // verify system page existence
+                            SiteView view = getSiteView();
+                            if (view != null)
+                            {
+                                try
+                                {
+                                    if (view.getNodeProxy(systemPageRequestPath, null, false,
false) instanceof Page)
+                                    {
+                                        systemType = PortalSiteContentTypeMapper.PAGE_SYSTEM_TYPE;
+                                    }
+                                }
+                                catch (NodeNotFoundException nnfe)
+                                {
+                                }
+                            }
+
+                            // log mapping
+                            if (systemType != null)
+                            {
+                                if (log.isDebugEnabled())
+                                {
+                                    log.debug("Mapped content request to existing system
page: serverName="+requestServerName+", contentType="+contentType+", requestPath="+requestPath+",
mapped to: "+systemPageRequestPath);
+                                }
+ 
+                                requestPath = systemPageRequestPath;
+                            }
+                        }
+
+                        // if not mapped to a system type, continue with content
+                        // dynamic page selection 
+                        if (systemType == null)
+                        {
+                            // support request path mapping of dynamic page requests
+                            String dynamicPageRequestPath = contentTypeMapper.mapDynamicRequestPath(requestServerName,
contentType, requestPath);
+                            if (dynamicPageRequestPath != null)
+                            {
+                                // log mapping
+                                if (log.isDebugEnabled())
+                                {
+                                    log.debug("Mapped content request to dynamic page: serverName="+requestServerName+",
contentType="+contentType+", requestPath="+requestPath+", mapped to: "+dynamicPageRequestPath);
+                                }
+                                
+                                requestPath = dynamicPageRequestPath;
+                            }
+
+                            // attempt to match content request against dynamic pages
+                            // using profile locators and site view; start at root
+                            // folder until path no longer matches and search from
+                            // there back up toward the root for dynamic pages by
+                            // content type; fallback to wildcard content type
+                            return selectContentRequestPage(requestPath, contentType);
+                        }
                     }
                 }
                 else

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/test/java/JETSPEED-INF/spring/test-spring.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/test/java/JETSPEED-INF/spring/test-spring.xml?rev=903419&r1=903418&r2=903419&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/test/java/JETSPEED-INF/spring/test-spring.xml
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/test/java/JETSPEED-INF/spring/test-spring.xml
Tue Jan 26 21:09:02 2010
@@ -170,6 +170,7 @@
   <bean id="org.apache.jetspeed.portalsite.PortalSiteContentTypeMapper" 
        name="portalSiteContentTypeMapper"
        class="org.apache.jetspeed.portalsite.impl.PortalSiteContentTypeMapperImpl">  
      
+       <!-- content type mapping -->
        <constructor-arg index="0">
            <list>
                <bean class="org.apache.jetspeed.portalsite.impl.ContentTypeMapping">
@@ -178,6 +179,7 @@
                </bean>
            </list>
        </constructor-arg>
+       <!-- dynamic page path mapping -->
        <constructor-arg index="1">
            <list>
                <bean class="org.apache.jetspeed.portalsite.impl.RequestPathMapping">
@@ -192,7 +194,30 @@
                </bean>
            </list>
        </constructor-arg>
-       <constructor-arg index="2"><value>true</value></constructor-arg>
+       <!-- system page path mapping -->
+       <constructor-arg index="2">
+           <list>
+               <bean class="org.apache.jetspeed.portalsite.impl.RequestPathMapping">
+                   <constructor-arg index="0"><value>/preview/</value></constructor-arg>
+                   <constructor-arg index="1"><value>/</value></constructor-arg>
+               </bean>
+               <bean class="org.apache.jetspeed.portalsite.impl.RequestPathMapping">
+                   <constructor-arg index="0"><value>[.](\w+)&#36;</value></constructor-arg>
<!-- use &#36; for '$' -->
+                   <constructor-arg index="1"><value>.psml</value></constructor-arg>
+               </bean>
+           </list>
+       </constructor-arg>
+       <!-- external content path mapping -->
+       <constructor-arg index="3">
+           <list>
+               <bean class="org.apache.jetspeed.portalsite.impl.RequestPathMapping">
+                   <constructor-arg index="0"><value>[.](\w+)&#36;</value></constructor-arg>
<!-- use &#36; for '$' -->
+                   <constructor-arg index="1"><value></value></constructor-arg>
+               </bean>
+           </list>
+       </constructor-arg>
+       <!-- enable content type fallback -->
+       <constructor-arg index="4"><value>true</value></constructor-arg>
   </bean>
   <bean id="org.apache.jetspeed.portalsite.PortalSite" 
        name="portalSite"

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/test/java/org/apache/jetspeed/portalsite/TestPortalSite.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/test/java/org/apache/jetspeed/portalsite/TestPortalSite.java?rev=903419&r1=903418&r2=903419&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/test/java/org/apache/jetspeed/portalsite/TestPortalSite.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal-site/src/test/java/org/apache/jetspeed/portalsite/TestPortalSite.java
Tue Jan 26 21:09:02 2010
@@ -1429,6 +1429,8 @@
         assertTrue(requestPageProxy instanceof DynamicPage);
         assertEquals("docpage.dpsml", requestPageProxy.getName());
         assertEquals("/docpage.dpsml", extractFileSystemPathFromId(requestPageProxy.getId()));
+        assertNotNull(requestContext.getPageContentPath());
+        assertEquals("/document", requestContext.getPageContentPath());
 
         locator = new JetspeedProfileLocator();
         locator.init(null, "/contentfolder/document.doc");
@@ -1442,6 +1444,8 @@
         assertTrue(requestPageProxy instanceof DynamicPage);
         assertEquals("docpage.dpsml", requestPageProxy.getName());
         assertEquals("/contentfolder/docpage.dpsml", extractFileSystemPathFromId(requestPageProxy.getId()));
+        assertNotNull(requestContext.getPageContentPath());
+        assertEquals("/contentfolder/document", requestContext.getPageContentPath());
 
         locator = new JetspeedProfileLocator();
         locator.init(null, "/contentfolder/document.txt");
@@ -1455,6 +1459,8 @@
         assertTrue(requestPageProxy instanceof DynamicPage);
         assertEquals("contentpage.dpsml", requestPageProxy.getName());
         assertEquals("/contentpage.dpsml", extractFileSystemPathFromId(requestPageProxy.getId()));
+        assertNotNull(requestContext.getPageContentPath());
+        assertEquals("/contentfolder/document", requestContext.getPageContentPath());
 
         locator = new JetspeedProfileLocator();
         locator.init(null, "/preview/document.doc");
@@ -1468,6 +1474,8 @@
         assertTrue(requestPageProxy instanceof DynamicPage);
         assertEquals("docpage.dpsml", requestPageProxy.getName());
         assertEquals("/docpage.dpsml", extractFileSystemPathFromId(requestPageProxy.getId()));
+        assertNotNull(requestContext.getPageContentPath());
+        assertEquals("/preview/document", requestContext.getPageContentPath());
 
         locator = new JetspeedProfileLocator();
         locator.init(null, "/preview/contentfolder/draft/document.doc", "test.domain.com");
@@ -1481,6 +1489,8 @@
         assertTrue(requestPageProxy instanceof DynamicPage);
         assertEquals("docpage.dpsml", requestPageProxy.getName());
         assertEquals("/contentfolder/pub/docpage.dpsml", extractFileSystemPathFromId(requestPageProxy.getId()));
+        assertNotNull(requestContext.getPageContentPath());
+        assertEquals("/preview/contentfolder/draft/document", requestContext.getPageContentPath());
 
         locator = new JetspeedProfileLocator();
         locator.init(null, "/document.psml");
@@ -1494,6 +1504,53 @@
         assertTrue(requestPageProxy instanceof DynamicPage);
         assertEquals("contentpage.dpsml", requestPageProxy.getName());
         assertEquals("/contentpage.dpsml", extractFileSystemPathFromId(requestPageProxy.getId()));
+        assertNotNull(requestContext.getPageContentPath());
+        assertEquals("/document", requestContext.getPageContentPath());
+
+        locator = new JetspeedProfileLocator();
+        locator.init(null, "/document.psml");
+        locator.add("user", true, false, "user");
+        locators = new HashMap();
+        locators.put(ProfileLocator.PAGE_LOCATOR, locator);
+        requestContext = sessionContext.newRequestContext(locators);
+        assertNotNull(requestContext);
+        requestPageProxy = requestContext.getPage();
+        assertNotNull(requestPageProxy);
+        assertTrue(requestPageProxy instanceof DynamicPage);
+        assertEquals("contentpage.dpsml", requestPageProxy.getName());
+        assertEquals("/contentpage.dpsml", extractFileSystemPathFromId(requestPageProxy.getId()));
+        assertNotNull(requestContext.getPageContentPath());
+        assertEquals("/document", requestContext.getPageContentPath());
+
+        locator = new JetspeedProfileLocator();
+        locator.init(null, "/preview/folder0/page0.doc");
+        locator.add("user", true, false, "user");
+        locators = new HashMap();
+        locators.put(ProfileLocator.PAGE_LOCATOR, locator);
+        requestContext = sessionContext.newRequestContext(locators);
+        assertNotNull(requestContext);
+        requestPageProxy = requestContext.getPage();
+        assertNotNull(requestPageProxy);
+        assertTrue(requestPageProxy instanceof Page);
+        assertEquals("page0.psml", requestPageProxy.getName());
+        assertEquals("/folder0/page0.psml", extractFileSystemPathFromId(requestPageProxy.getId()));
+        assertNotNull(requestContext.getPageContentPath());
+        assertEquals("/preview/folder0/page0", requestContext.getPageContentPath());
+
+        locator = new JetspeedProfileLocator();
+        locator.init(null, "/page2.doc");
+        locator.add("user", true, false, "user");
+        locators = new HashMap();
+        locators.put(ProfileLocator.PAGE_LOCATOR, locator);
+        requestContext = sessionContext.newRequestContext(locators);
+        assertNotNull(requestContext);
+        requestPageProxy = requestContext.getPage();
+        assertNotNull(requestPageProxy);
+        assertTrue(requestPageProxy instanceof Page);
+        assertEquals("page2.psml", requestPageProxy.getName());
+        assertEquals("/_user/user/page2.psml", extractFileSystemPathFromId(requestPageProxy.getId()));
+        assertNotNull(requestContext.getPageContentPath());
+        assertEquals("/page2", requestContext.getPageContentPath());
     }
 
     /**

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/profiler/impl/ProfilerValveImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/profiler/impl/ProfilerValveImpl.java?rev=903419&r1=903418&r2=903419&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/profiler/impl/ProfilerValveImpl.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/profiler/impl/ProfilerValveImpl.java
Tue Jan 26 21:09:02 2010
@@ -272,6 +272,7 @@
                 if (requestContext.isContentPage())
                 {
                     request.setAttribute(PortalReservedParameters.PATH_ATTRIBUTE, requestPath);
+                    request.setAttribute(PortalReservedParameters.CONTENT_PATH_ATTRIBUTE,
requestContext.getPageContentPath());
                 }
 
                 request.setAttribute(PortalReservedParameters.PAGE_EDIT_ACCESS_ATTRIBUTE,getPageActionAccess(request));

Modified: portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/PortalReservedParameters.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/PortalReservedParameters.java?rev=903419&r1=903418&r2=903419&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/PortalReservedParameters.java
(original)
+++ portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/PortalReservedParameters.java
Tue Jan 26 21:09:02 2010
@@ -62,6 +62,7 @@
     public static final String HEADER_NAMED_RESOURCE_ADDED_FRAGMENTS_ATTRIBUTE = "org.apache.jetspeed.headernamedresourceaddedfragments";
     public static final String HEADER_NAMED_RESOURCE_REGISTRY_ATTRIBUTE = "org.apache.jetspeed.headernamedresourceregistry";
     public static final String PATH_ATTRIBUTE = "org.apache.jetspeed.Path";
+    public static final String CONTENT_PATH_ATTRIBUTE = "org.apache.jetspeed.ContentPath";
     public static final String PARAMETER_ALREADY_DECODED_ATTRIBUTE = "org.apache.jetspeed.parameterAlreadyDecoded";
     public static final String RESOVLER_CACHE_ATTR = "org.apache.jetspeed.resovler.cache";
     public static final String PORTLET_DEFINITION_ATTRIBUTE = "org.apache.jetspeed.portlet.definition";

Modified: portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/portalsite/PortalSiteContentTypeMapper.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/portalsite/PortalSiteContentTypeMapper.java?rev=903419&r1=903418&r2=903419&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/portalsite/PortalSiteContentTypeMapper.java
(original)
+++ portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/portalsite/PortalSiteContentTypeMapper.java
Tue Jan 26 21:09:02 2010
@@ -56,14 +56,39 @@
     String mapContentType(String requestPath);
 
     /**
-     * mapRequestPath - map content request path given previously mapped content
-     *                  type; implementation should return null to indicate no
-     *                  mapping is available.
+     * mapSystemRequestPath - map content request path given previously mapped
+     *                        content type to existing system page or folder;
+     *                        implementation should return null to indicate no
+     *                        mapping is available.
      *
      * @param serverName request server name
      * @param contentType mapped content type
      * @param requestPath raw portal request path
-     * @return mapped request path or null
+     * @return mapped system page or folder path or null
      */
-    String mapRequestPath(String serverName, String contentType, String requestPath);
+    String mapSystemRequestPath(String serverName, String contentType, String requestPath);
+
+    /**
+     * mapDynamicRequestPath - map content request path given previously mapped
+     *                         content type to dynamic page; implementation should
+     *                         return null to indicate no mapping is available.
+     *
+     * @param serverName request server name
+     * @param contentType mapped content type
+     * @param requestPath raw portal request path
+     * @return mapped dynamic page path or null
+     */
+    String mapDynamicRequestPath(String serverName, String contentType, String requestPath);
+
+    /**
+     * mapContentRequestPath - map content request path given previously mapped
+     *                         content type to external content path; implementation
+     *                         should return null to indicate no mapping is available.
+     *
+     * @param serverName request server name
+     * @param contentType mapped content type
+     * @param requestPath raw portal request path
+     * @return mapped dynamic page path or null
+     */
+    String mapContentRequestPath(String serverName, String contentType, String requestPath);
 }

Modified: portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/portalsite/PortalSiteRequestContext.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/portalsite/PortalSiteRequestContext.java?rev=903419&r1=903418&r2=903419&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/portalsite/PortalSiteRequestContext.java
(original)
+++ portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/portalsite/PortalSiteRequestContext.java
Tue Jan 26 21:09:02 2010
@@ -99,6 +99,15 @@
     BaseConcretePageElement getPage() throws NodeNotFoundException;
 
     /**
+     * getPageContentPath - get content path associated with request page
+     *  
+     * @return content path
+     * @throws NodeNotFoundException if page not found
+     * @throws SecurityException if page view access not granted
+     */
+    String getPageContentPath() throws NodeNotFoundException;
+
+    /**
      * getPageTemplate - get page template proxy for request profiled page
      *  
      * @return page template proxy if found or null



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


Mime
View raw message