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 Summary
Fields inherited from interface freemarker.template.TemplateModel
NOTHING
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
forwardCategoryUri
(HttpServletRequest request, HttpServletResponse response, Delegator delegator, String controlServlet) Forward a category uri according to forward pattern regular expressions.static boolean
forwardProductUri
(HttpServletRequest request, HttpServletResponse response, Delegator delegator) static boolean
forwardProductUri
(HttpServletRequest request, HttpServletResponse response, Delegator delegator, String controlServlet) static boolean
forwardUri
(HttpServletRequest request, HttpServletResponse response, Delegator delegator, String controlServlet) Forward a uri according to forward pattern regular expressions.Get the category id/name map.Get the category name/id map.protected static String
getNiceName
(String name) Get a string lower cased and hyphen connected.getStringArg
(Map<?, ?> args, String key) Gets string arg.static void
initCategoryMap
(HttpServletRequest request) Initial category-name/category-id map.static void
initCategoryMap
(HttpServletRequest request, Delegator delegator) static boolean
Check whether the category map is initialed.static String
makeCategoryUrl
(HttpServletRequest request, String currentCategoryId, String previousCategoryId, String viewSize, String viewIndex, String viewSort, String searchString) Make category url according to the configurations.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.static String
makeProductUrl
(String contextPath, List<String> trail, String productId, String productName, String currentCategoryId, String previousCategoryId) Make product url according to the configurations.static String
makeProductUrl
(HttpServletRequest request, String productId, String currentCategoryId, String previousCategoryId) Make product url according to the configurations.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.
-
Field Details
-
URL_HYPHEN
- See Also:
-
-
Constructor Details
-
CatalogUrlSeoTransform
public CatalogUrlSeoTransform()
-
-
Method Details
-
getStringArg
Gets string arg.- Parameters:
args
- the argskey
- the key- Returns:
- the string arg
-
getWriter
public Writer getWriter(Writer out, Map args) throws freemarker.template.TemplateModelException, IOException - Specified by:
getWriter
in interfacefreemarker.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
Get the category name/id map.- Returns:
- the category name/id map
-
getCategoryIdNameMap
Get the category id/name map.- Returns:
- the category id/name map
-
initCategoryMap
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
-
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
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:
-