portals-portalapps-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From woon...@apache.org
Subject svn commit: r945107 - in /portals/applications/sandbox/content/trunk: etc/assembly/override/ etc/pages/ src/main/java/org/apache/portals/applications/content/ src/main/webapp/WEB-INF/view/
Date Mon, 17 May 2010 12:14:27 GMT
Author: woonsan
Date: Mon May 17 12:14:27 2010
New Revision: 945107

URL: http://svn.apache.org/viewvc?rev=945107&view=rev
Log:
Refining dynamic content portlet.
Also, changing the dpsml url from /news/* to /content/* to allow browsing other contents which
are not under /news/.

Modified:
    portals/applications/sandbox/content/trunk/etc/assembly/override/site-mappings.xml
    portals/applications/sandbox/content/trunk/etc/pages/jcr-content.dpsml
    portals/applications/sandbox/content/trunk/src/main/java/org/apache/portals/applications/content/DynamicContentPortlet.java
    portals/applications/sandbox/content/trunk/src/main/webapp/WEB-INF/view/generic-query-content-view.jsp
    portals/applications/sandbox/content/trunk/src/main/webapp/WEB-INF/view/generic-search-query-content-view.jsp

Modified: portals/applications/sandbox/content/trunk/etc/assembly/override/site-mappings.xml
URL: http://svn.apache.org/viewvc/portals/applications/sandbox/content/trunk/etc/assembly/override/site-mappings.xml?rev=945107&r1=945106&r2=945107&view=diff
==============================================================================
--- portals/applications/sandbox/content/trunk/etc/assembly/override/site-mappings.xml (original)
+++ portals/applications/sandbox/content/trunk/etc/assembly/override/site-mappings.xml Mon
May 17 12:14:27 2010
@@ -26,7 +26,7 @@
       <list>
         <bean class="org.apache.jetspeed.portalsite.impl.ContentTypeMapping">
           <constructor-arg index="0">
-            <value>^/content/.*\w[.](\w+)&#36;</value> <!-- use &#36;
for '$' -->
+            <value>^/webcontent/.*\w[.](\w+)&#36;</value> <!-- use &#36;
for '$' -->
           </constructor-arg>
           <constructor-arg index="1">
             <value>&#36;1</value> <!-- use &#36; for '$' -->
@@ -34,7 +34,7 @@
         </bean>
         <bean class="org.apache.jetspeed.portalsite.impl.ContentTypeMapping">
           <constructor-arg index="0">
-            <value>^/content/</value>
+            <value>^/webcontent/</value>
           </constructor-arg>
           <constructor-arg index="1">
             <value>html</value>
@@ -42,7 +42,7 @@
         </bean>
         <bean class="org.apache.jetspeed.portalsite.impl.ContentTypeMapping">
           <constructor-arg index="0">
-            <value>^/news/.*\w[.](\w+)&#36;</value> <!-- use &#36;
for '$' -->
+            <value>^/content/.*\w[.](\w+)&#36;</value> <!-- use &#36;
for '$' -->
           </constructor-arg>
           <constructor-arg index="1">
             <value>&#36;1</value> <!-- use &#36; for '$' -->
@@ -50,7 +50,7 @@
         </bean>
         <bean class="org.apache.jetspeed.portalsite.impl.ContentTypeMapping">
           <constructor-arg index="0">
-            <value>^/news/</value>
+            <value>^/content/</value>
           </constructor-arg>
           <constructor-arg index="1">
             <value>html</value>

Modified: portals/applications/sandbox/content/trunk/etc/pages/jcr-content.dpsml
URL: http://svn.apache.org/viewvc/portals/applications/sandbox/content/trunk/etc/pages/jcr-content.dpsml?rev=945107&r1=945106&r2=945107&view=diff
==============================================================================
--- portals/applications/sandbox/content/trunk/etc/pages/jcr-content.dpsml (original)
+++ portals/applications/sandbox/content/trunk/etc/pages/jcr-content.dpsml Mon May 17 12:14:27
2010
@@ -27,16 +27,16 @@ limitations under the License.
     <fragment id="dcms-2-content" type="portlet" name="apa-content::NewsItemPortlet">
       <property name="row" value="0" />
       <property name="column" value="0" />
-      <preference name="SRC">
-        <value>/content/documents/en/news/</value>
+      <preference name="basePathInfo">
+        <value>/content</value>
       </preference>
-      <preference name="PORTALPATH">
-        <value>/news/</value>
+      <preference name="contentBasePath">
+        <value>/content/documents/en</value>
       </preference>
     </fragment>
     <fragment-reference id="dcms-3-wp-reference" refid="wp-definition">
-        <property name="row" value="0"/>
-        <property name="column" value="1"/>
+      <property name="row" value="0"/>
+      <property name="column" value="1"/>
     </fragment-reference>
   </fragment>
 

Modified: portals/applications/sandbox/content/trunk/src/main/java/org/apache/portals/applications/content/DynamicContentPortlet.java
URL: http://svn.apache.org/viewvc/portals/applications/sandbox/content/trunk/src/main/java/org/apache/portals/applications/content/DynamicContentPortlet.java?rev=945107&r1=945106&r2=945107&view=diff
==============================================================================
--- portals/applications/sandbox/content/trunk/src/main/java/org/apache/portals/applications/content/DynamicContentPortlet.java
(original)
+++ portals/applications/sandbox/content/trunk/src/main/java/org/apache/portals/applications/content/DynamicContentPortlet.java
Mon May 17 12:14:27 2010
@@ -16,15 +16,11 @@
  */
 package org.apache.portals.applications.content;
 
-import java.util.Map;
-
 import javax.portlet.PortletException;
 import javax.portlet.PortletRequest;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.jetspeed.request.RequestContext;
-import org.apache.portals.messaging.PortletMessaging;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * DynamicContentPortlet
@@ -33,57 +29,27 @@ import org.slf4j.LoggerFactory;
  */
 public class DynamicContentPortlet extends GenericContentPortlet 
 {
-    private final static Logger log = LoggerFactory.getLogger(DynamicContentPortlet.class);
-
+    
     @Override
     protected String getContentPath(final PortletRequest request) throws PortletException
     {
         RequestContext rc = (RequestContext) request.getAttribute(RequestContext.REQUEST_PORTALENV);
-
-        // get source web content URL, parameters, and method to view
-        String sourceURL = null;
-        Map sourceParams = null;
-        boolean sourcePostMethod = false;
-        Object msg = PortletMessaging.receive(request, getClass().getName());
-        if (msg != null)
+        String contentBasePath = request.getPreferences().getValue("contentBasePath", null);
+        String basePathInfo = request.getPreferences().getValue("basePathInfo", null);
+        
+        if (StringUtils.isBlank(contentBasePath) || StringUtils.isBlank(basePathInfo))
         {
-            // view rewritten action URL page
-//            sourceURL = webContentPage.getUrl();
-//            sourceParams = webContentPage.getParams();
-//            sourcePostMethod = webContentPage.isPost();            
+            throw new PortletException("Required contentBasePath and portalBasePath preferences
are not set!");
         }
-        else
+        
+        String requestPathInfo = rc.getPath();
+        
+        if (!requestPathInfo.startsWith(basePathInfo))
         {
-            // load and validate preferences, (base url and portal base path
-            // should both end in a "/" path separator to ensure that relative
-            // urls in the content resolve predictably)
-            String baseURL = request.getPreferences().getValue("SRC", null);
-            String portalBasePath = request.getPreferences().getValue("PORTALPATH", null);
-            if ((baseURL == null) || (portalBasePath == null))
-            {
-                throw new PortletException("Required SRC and PORTALPATH preferences not set");
-            }
-            if (!baseURL.endsWith("/"))
-            {
-                baseURL += "/";
-            }
-            if (!portalBasePath.startsWith("/"))
-            {
-                portalBasePath = "/"+portalBasePath;
-            }        
-            if (!portalBasePath.endsWith("/"))
-            {
-                portalBasePath += "/";
-            }        
-            // view content page based on portal request URL
-            String portalRequestPath = rc.getPath();
-            if (!portalRequestPath.startsWith(portalBasePath))
-            {
-                throw new PortletException("Unable to map portal request path: "+portalRequestPath+"
onto portal base path: "+portalBasePath);
-            }
-            sourceURL = baseURL+portalRequestPath.substring(portalBasePath.length());   
        
+            throw new PortletException("Unable to map portal request path: " + requestPathInfo
+ " onto base path info: " + basePathInfo);
         }
-        return sourceURL;
+        
+        return contentBasePath + StringUtils.substringAfter(requestPathInfo, basePathInfo);
     }
     
 }

Modified: portals/applications/sandbox/content/trunk/src/main/webapp/WEB-INF/view/generic-query-content-view.jsp
URL: http://svn.apache.org/viewvc/portals/applications/sandbox/content/trunk/src/main/webapp/WEB-INF/view/generic-query-content-view.jsp?rev=945107&r1=945106&r2=945107&view=diff
==============================================================================
--- portals/applications/sandbox/content/trunk/src/main/webapp/WEB-INF/view/generic-query-content-view.jsp
(original)
+++ portals/applications/sandbox/content/trunk/src/main/webapp/WEB-INF/view/generic-query-content-view.jsp
Mon May 17 12:14:27 2010
@@ -32,7 +32,7 @@ limitations under the License.
 <hr/>
 
 <c:forEach var="contentItem" items="${contentBean}">
-<h3><a href="${portalContextPath}${portalServletPath}${fn:substringAfter(contentItem.path,
contentUrlBase)}">${contentItem.title}</a></h3>
+<h3><a href="${portalContextPath}${portalServletPath}/content${fn:substringAfter(contentItem.path,
contentUrlBase)}">${contentItem.title}</a></h3>
 <div align="right">(${contentItem.documentDate})</div>
 <div>${contentItem.introduction}</div>
 <p>&nbsp;</p>

Modified: portals/applications/sandbox/content/trunk/src/main/webapp/WEB-INF/view/generic-search-query-content-view.jsp
URL: http://svn.apache.org/viewvc/portals/applications/sandbox/content/trunk/src/main/webapp/WEB-INF/view/generic-search-query-content-view.jsp?rev=945107&r1=945106&r2=945107&view=diff
==============================================================================
--- portals/applications/sandbox/content/trunk/src/main/webapp/WEB-INF/view/generic-search-query-content-view.jsp
(original)
+++ portals/applications/sandbox/content/trunk/src/main/webapp/WEB-INF/view/generic-search-query-content-view.jsp
Mon May 17 12:14:27 2010
@@ -70,7 +70,7 @@ Additional custom JCR expression: <input
 <hr/>
 
 <c:forEach var="contentItem" items="${contentBean}">
-<h3><a href="${portalContextPath}${portalServletPath}${fn:substringAfter(contentItem.path,
contentUrlBase)}">${contentItem.title}</a></h3>
+<h3><a href="${portalContextPath}${portalServletPath}/content${fn:substringAfter(contentItem.path,
contentUrlBase)}">${contentItem.title}</a></h3>
 <div align="right">(${contentItem.documentDate})</div>
 <div>${contentItem.introduction}</div>
 <p>&nbsp;</p>



Mime
View raw message