Author: jleroux Date: Thu Oct 24 09:22:04 2013 New Revision: 1535324 URL: http://svn.apache.org/r1535324 Log: A patch from Shi Jinghai for "Proposal: URL-Generation Changes" https://issues.apache.org/jira/browse/OFBIZ-5312
This patch is for the seo branch you created last night. There's a bug while checking whether a url path is a category url and it's fixed. Several files are for ofbiz old version and can be removed: CategoryUrlServlet.java: for /category/ servlet ProductUrlServlet.java: for /product/ servlet SeoCatalogUrlFilter.java: I cannot remember why it's here. I guess it's because some method is invisible in old version of CatalogUrlFilter.java, so I copied it here. jleroux: for now I left those files, I will review more to better understand things before Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/src/org/ofbiz/product/category/ftl/CatalogUrlSeoTransform.java ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/web.xml Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/src/org/ofbiz/product/category/ftl/CatalogUrlSeoTransform.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/src/org/ofbiz/product/category/ftl/CatalogUrlSeoTransform.java?rev=1535324&r1=1535323&r2=1535324&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/src/org/ofbiz/product/category/ftl/CatalogUrlSeoTransform.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/product/src/org/ofbiz/product/category/ftl/CatalogUrlSeoTransform.java Thu Oct 24 09:22:04 2013 @@ -51,6 +51,7 @@ import org.ofbiz.entity.condition.Entity import org.ofbiz.product.category.CatalogUrlServlet; import org.ofbiz.product.category.CategoryContentWrapper; import org.ofbiz.product.category.CategoryWorker; +import org.ofbiz.product.category.SeoUrlUtil; import org.ofbiz.product.category.UrlRegexpConfigUtil; import org.ofbiz.product.category.UrlUtil; import org.ofbiz.product.product.ProductContentWrapper; @@ -509,6 +510,10 @@ public class CatalogUrlSeoTransform impl if (UtilValidate.isEmpty(pathElements)) { return false; } + // remove context path + pathInfo = SeoUrlUtil.removeContextPath(pathInfo, contextPath); + // remove servlet path + pathInfo = SeoUrlUtil.removeContextPath(pathInfo, request.getServletPath()); if (pathInfo.startsWith("/" + CatalogUrlServlet.CATEGORY_REQUEST + "/")) { return forwardCategoryUri(request, response, delegator, controlServlet); } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/web.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/web.xml?rev=1535324&r1=1535323&r2=1535324&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/web.xml (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/web.xml Thu Oct 24 09:22:04 2013 @@ -62,7 +62,7 @@ under the License. <filter> <filter-name>SeoCatalogUrlFilter</filter-name> <display-name>SeoCatalogUrlFilter</display-name> - <filter-class>org.ofbiz.product.category.SeoCatalogUrlFilter</filter-class> + <filter-class>org.ofbiz.product.category.CatalogUrlSeoFilter</filter-class> <init-param><param-name>defaultLocaleString</param-name><param-value>en_US</param-value></init-param> </filter> <filter>