Class CatalogUrlSeoTransform

java.lang.Object
org.apache.ofbiz.product.category.ftl.CatalogUrlSeoTransform
All Implemented Interfaces:
freemarker.template.TemplateModel, freemarker.template.TemplateTransformModel

public class CatalogUrlSeoTransform extends Object implements freemarker.template.TemplateTransformModel
  • Field Details

  • Constructor Details

    • CatalogUrlSeoTransform

      public CatalogUrlSeoTransform()
  • Method Details

    • getStringArg

      public String getStringArg(Map<?,?> args, String key)
      Gets string arg.
      Parameters:
      args - the args
      key - the key
      Returns:
      the string arg
    • getWriter

      public Writer getWriter(Writer out, Map args) throws freemarker.template.TemplateModelException, IOException
      Specified by:
      getWriter in interface freemarker.template.TemplateTransformModel
      Throws:
      freemarker.template.TemplateModelException
      IOException
    • isCategoryMapInitialed

      public static boolean isCategoryMapInitialed()
      Check whether the category map is initialed.
      Returns:
      a boolean value to indicate whether the category map has been initialized.
    • getCategoryNameIdMap

      public static Map<String,String> getCategoryNameIdMap()
      Get the category name/id map.
      Returns:
      the category name/id map
    • getCategoryIdNameMap

      public static Map<String,String> getCategoryIdNameMap()
      Get the category id/name map.
      Returns:
      the category id/name map
    • initCategoryMap

      public static void initCategoryMap(HttpServletRequest request)
      Initial category-name/category-id map. Note: as a key, the category-name should be: 1. ascii 2. lower cased and use hyphen between the words. If not, the category id will be used.
    • initCategoryMap

      public static void initCategoryMap(HttpServletRequest request, Delegator delegator)
    • makeProductUrl

      public static String makeProductUrl(HttpServletRequest request, String productId, String currentCategoryId, String previousCategoryId)
      Make product url according to the configurations.
      Returns:
      String a catalog url
    • makeCategoryUrl

      public static String makeCategoryUrl(HttpServletRequest request, String currentCategoryId, String previousCategoryId, String viewSize, String viewIndex, String viewSort, String searchString)
      Make category url according to the configurations.
      Returns:
      String a category url
    • makeProductUrl

      public static String makeProductUrl(String contextPath, List<String> trail, String productId, String productName, String currentCategoryId, String previousCategoryId)
      Make product url according to the configurations.
      Returns:
      String a catalog url
    • getNiceName

      protected static String getNiceName(String name)
      Get a string lower cased and hyphen connected.
      Parameters:
      name - a String to be transformed
      Returns:
      String nice name
    • forwardProductUri

      public static boolean forwardProductUri(HttpServletRequest request, HttpServletResponse response, Delegator delegator) throws ServletException, IOException
      Throws:
      ServletException
      IOException
    • forwardProductUri

      public static boolean forwardProductUri(HttpServletRequest request, HttpServletResponse response, Delegator delegator, String controlServlet) throws ServletException, IOException
      Throws:
      ServletException
      IOException
    • forwardUri

      public static boolean forwardUri(HttpServletRequest request, HttpServletResponse response, Delegator delegator, String controlServlet) throws ServletException, IOException
      Forward a uri according to forward pattern regular expressions.
      Parameters:
      request -
      response -
      delegator -
      controlServlet -
      Returns:
      boolean to indicate whether the uri is forwarded.
      Throws:
      ServletException
      IOException
    • forwardCategoryUri

      public static boolean forwardCategoryUri(HttpServletRequest request, HttpServletResponse response, Delegator delegator, String controlServlet) throws ServletException, IOException
      Forward a category uri according to forward pattern regular expressions.
      Parameters:
      request -
      response -
      delegator -
      controlServlet -
      Returns:
      Throws:
      ServletException
      IOException
    • makeProductUrl

      public static String makeProductUrl(Delegator delegator, ProductContentWrapper wrapper, String prefix, String contextPath, String currentCategoryId, String previousCategoryId, String productId)
      This is used when building product url in services.
      Parameters:
      delegator -
      wrapper -
      prefix -
      contextPath -
      currentCategoryId -
      previousCategoryId -
      productId -
      Returns:
    • makeCategoryUrl

      public static String makeCategoryUrl(Delegator delegator, CategoryContentWrapper wrapper, String prefix, String currentCategoryId, String previousCategoryId, String productId, String viewSize, String viewIndex, String viewSort, String searchString)
      This is used when building category url in services.
      Parameters:
      delegator -
      wrapper -
      prefix -
      currentCategoryId -
      previousCategoryId -
      productId -
      viewSize -
      viewIndex -
      viewSort -
      searchString -
      Returns: