Author: jonesde
Date: Fri Mar 13 05:15:10 2009 New Revision: 753118 URL: http://svn.apache.org/viewvc?rev=753118&view=rev Log: A few changes to fix issues with the catalog search engine friendly urls when ecommerce is mounted on the root of the server, as reported in Jira #OFBIZ-2238; there was an issue with 2 forwarded slashes at the beginning instead of one, and the servlet mount of catalog conflicted with the catalog webapp, so changed that to products Modified: ofbiz/trunk/applications/ecommerce/ofbiz-component.xml ofbiz/trunk/applications/ecommerce/webapp/ecomclone/WEB-INF/web.xml ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/web.xml ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/web.xml ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CatalogUrlServlet.java Modified: ofbiz/trunk/applications/ecommerce/ofbiz-component.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/ofbiz-component.xml?rev=753118&r1=753117&r2=753118&view=diff ============================================================================== --- ofbiz/trunk/applications/ecommerce/ofbiz-component.xml (original) +++ ofbiz/trunk/applications/ecommerce/ofbiz-component.xml Fri Mar 13 05:15:10 2009 @@ -56,7 +56,7 @@ title="eCommerce" server="default-server" location="webapp/ecommerce" - mount-point="/ecommerce" + mount-point="/" app-bar-display="false"/> <webapp name="ecomclone" title="eCommerce Clone" Modified: ofbiz/trunk/applications/ecommerce/webapp/ecomclone/WEB-INF/web.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecomclone/WEB-INF/web.xml?rev=753118&r1=753117&r2=753118&view=diff ============================================================================== --- ofbiz/trunk/applications/ecommerce/webapp/ecomclone/WEB-INF/web.xml (original) +++ ofbiz/trunk/applications/ecommerce/webapp/ecomclone/WEB-INF/web.xml Fri Mar 13 05:15:10 2009 @@ -60,7 +60,7 @@ </init-param> <init-param> <param-name>allowedPaths</param-name> - <param-value>/control:/select:/index.html:/index.jsp:/default.html:/default.jsp:/images</param-value> + <param-value>/control:/products:/select:/index.html:/index.jsp:/default.html:/default.jsp:/images</param-value> </init-param> <init-param> <param-name>errorCode</param-name> @@ -91,7 +91,7 @@ <description>Main Control Servlet</description> <servlet-class>org.ofbiz.webapp.control.ControlServlet</servlet-class> <load-on-startup>1</load-on-startup> - </servlet> + </servlet> <!-- un-comment for Worldpay <servlet> <servlet-name>select</servlet-name> @@ -101,6 +101,13 @@ <load-on-startup>5</load-on-startup> </servlet> --> + <servlet> + <servlet-name>CatalogUrlServlet</servlet-name> + <display-name>CatalogUrlServlet</display-name> + <description>Catalog (Category/Product) URL Servlet</description> + <servlet-class>org.ofbiz.product.category.CatalogUrlServlet</servlet-class> + <load-on-startup>1</load-on-startup> + </servlet> <servlet-mapping> <servlet-name>ControlServlet</servlet-name> @@ -112,7 +119,11 @@ <url-pattern>/select/*</url-pattern> </servlet-mapping> --> - + <servlet-mapping> + <servlet-name>CatalogUrlServlet</servlet-name> + <url-pattern>/products/*</url-pattern> + </servlet-mapping> + <session-config> <session-timeout>60</session-timeout> </session-config> Modified: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/web.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/web.xml?rev=753118&r1=753117&r2=753118&view=diff ============================================================================== --- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/web.xml (original) +++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/web.xml Fri Mar 13 05:15:10 2009 @@ -60,7 +60,7 @@ </init-param> <init-param> <param-name>allowedPaths</param-name> - <param-value>/control:/catalog:/select:/index.html:/index.jsp:/default.html:/default.jsp:/images</param-value> + <param-value>/control:/products:/select:/index.html:/index.jsp:/default.html:/default.jsp:/images</param-value> </init-param> <init-param> <param-name>errorCode</param-name> @@ -121,7 +121,7 @@ --> <servlet-mapping> <servlet-name>CatalogUrlServlet</servlet-name> - <url-pattern>/catalog/*</url-pattern> + <url-pattern>/products/*</url-pattern> </servlet-mapping> <session-config> Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/web.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/web.xml?rev=753118&r1=753117&r2=753118&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/web.xml (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/web.xml Fri Mar 13 05:15:10 2009 @@ -61,7 +61,7 @@ </init-param> <init-param> <param-name>allowedPaths</param-name> - <param-value>/control:/catalog:/select:/index.html:/index.jsp:/default.html:/default.jsp:/images:/includes/maincss.css</param-value> + <param-value>/control:/products:/select:/index.html:/index.jsp:/default.html:/default.jsp:/images:/includes/maincss.css</param-value> </init-param> <init-param> <param-name>errorCode</param-name> @@ -103,7 +103,7 @@ </servlet-mapping> <servlet-mapping> <servlet-name>CatalogUrlServlet</servlet-name> - <url-pattern>/catalog/*</url-pattern> + <url-pattern>/products/*</url-pattern> </servlet-mapping> <session-config> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CatalogUrlServlet.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CatalogUrlServlet.java?rev=753118&r1=753117&r2=753118&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CatalogUrlServlet.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CatalogUrlServlet.java Fri Mar 13 05:15:10 2009 @@ -20,7 +20,6 @@ import java.io.IOException; import java.util.List; -import java.util.Map; import javax.servlet.RequestDispatcher; import javax.servlet.ServletConfig; @@ -33,7 +32,6 @@ import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.StringUtil; -import org.ofbiz.base.util.UtilHttp; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.GenericDelegator; @@ -47,7 +45,7 @@ public static final String module = CatalogUrlServlet.class.getName(); - public static final String CATALOG_URL_MOUNT_POINT = "catalog"; + public static final String CATALOG_URL_MOUNT_POINT = "products"; public static final String CONTROL_MOUNT_POINT = "control"; public static final String PRODUCT_REQUEST = "product"; public static final String CATEGORY_REQUEST = "category"; @@ -147,7 +145,9 @@ public static String makeCatalogUrl(HttpServletRequest request, String productId, String currentCategoryId, String previousCategoryId) { StringBuilder urlBuilder = new StringBuilder(); urlBuilder.append(request.getSession().getServletContext().getContextPath()); - urlBuilder.append("/"); + if (urlBuilder.charAt(urlBuilder.length() - 1) != '/') { + urlBuilder.append("/"); + } urlBuilder.append(CATALOG_URL_MOUNT_POINT); if (UtilValidate.isNotEmpty(currentCategoryId)) { |
Free forum by Nabble | Edit this page |