svn commit: r1178317 - in /ofbiz/trunk: applications/content/src/org/ofbiz/content/content/ContentUrlFilter.java specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/web.xml

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1178317 - in /ofbiz/trunk: applications/content/src/org/ofbiz/content/content/ContentUrlFilter.java specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/web.xml

hansbak-2
Author: hansbak
Date: Mon Oct  3 07:37:01 2011
New Revision: 1178317

URL: http://svn.apache.org/viewvc?rev=1178317&view=rev
Log:
seo friendly url did not work on blog entries: reported by Ruth on the ofbiz mailing list

Modified:
    ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentUrlFilter.java
    ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/web.xml

Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentUrlFilter.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentUrlFilter.java?rev=1178317&r1=1178316&r2=1178317&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentUrlFilter.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentUrlFilter.java Mon Oct  3 07:37:01 2011
@@ -74,6 +74,7 @@ public class ContentUrlFilter extends Co
                 try {
                     List<GenericValue> contentDataResourceViews = delegator.findByAnd("ContentDataResourceView", UtilMisc.toMap("drObjectInfo", alternativeUrl));
                     if (contentDataResourceViews.size() > 0) {
+                        contentDataResourceViews = EntityUtil.orderBy(contentDataResourceViews, UtilMisc.toList("createdDate DESC"));
                         GenericValue contentDataResourceView = EntityUtil.getFirst(contentDataResourceViews);
                         List<GenericValue> contents = EntityUtil.filterByDate(delegator.findByAnd("ContentAssoc", UtilMisc.toMap("contentAssocTypeId", "ALTERNATIVE_URL", "contentIdTo", contentDataResourceView.getString("contentId"))));
                         if (contents.size() > 0) {
@@ -123,6 +124,10 @@ public class ContentUrlFilter extends Co
                 url = contentAssocDataResource.getString("drObjectInfo");
                 try {
                     url = StringUtil.defaultWebEncoder.decodeFromURL(url);
+                    String mountPoint = request.getContextPath();
+                    if (mountPoint != "/") {
+                        url = mountPoint + url;
+                    }
                 } catch (EncodingException e) {
                     Debug.logError(e, module);
                 }

Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/web.xml?rev=1178317&r1=1178316&r2=1178317&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/web.xml (original)
+++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/web.xml Mon Oct  3 07:37:01 2011
@@ -65,7 +65,7 @@ under the License.
         <init-param><param-name>defaultLocaleString</param-name><param-value>en_US</param-value></init-param>
         <init-param><param-name>redirectUrl</param-name><param-value>/control/main</param-value></init-param>
     </filter>
- <filter>
+    <filter>
         <filter-name>ContentUrlFilter</filter-name>
         <display-name>ContentUrlFilter</display-name>
         <filter-class>org.ofbiz.content.content.ContentUrlFilter</filter-class>