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 java.lang.Object implements freemarker.template.TemplateTransformModel
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
module
static java.lang.String
URL_HYPHEN
-
Constructor Summary
Constructors Constructor Description CatalogUrlSeoTransform()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static boolean
forwardCategoryUri(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Delegator delegator, java.lang.String controlServlet)
Forward a category uri according to forward pattern regular expressions.static boolean
forwardProductUri(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Delegator delegator)
static boolean
forwardProductUri(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Delegator delegator, java.lang.String controlServlet)
static boolean
forwardUri(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Delegator delegator, java.lang.String controlServlet)
Forward a uri according to forward pattern regular expressions.static java.util.Map<java.lang.String,java.lang.String>
getCategoryIdNameMap()
Get the category id/name map.static java.util.Map<java.lang.String,java.lang.String>
getCategoryNameIdMap()
Get the category name/id map.protected static java.lang.String
getNiceName(java.lang.String name)
Get a string lower cased and hyphen connected.java.lang.String
getStringArg(java.util.Map<?,?> args, java.lang.String key)
java.io.Writer
getWriter(java.io.Writer out, java.util.Map args)
static void
initCategoryMap(javax.servlet.http.HttpServletRequest request)
Initial category-name/category-id map.static void
initCategoryMap(javax.servlet.http.HttpServletRequest request, Delegator delegator)
static boolean
isCategoryMapInitialed()
Check whether the category map is initialed.static java.lang.String
makeCategoryUrl(javax.servlet.http.HttpServletRequest request, java.lang.String currentCategoryId, java.lang.String previousCategoryId, java.lang.String viewSize, java.lang.String viewIndex, java.lang.String viewSort, java.lang.String searchString)
Make category url according to the configurations.static java.lang.String
makeCategoryUrl(Delegator delegator, CategoryContentWrapper wrapper, java.lang.String prefix, java.lang.String currentCategoryId, java.lang.String previousCategoryId, java.lang.String productId, java.lang.String viewSize, java.lang.String viewIndex, java.lang.String viewSort, java.lang.String searchString)
This is used when building category url in services.static java.lang.String
makeProductUrl(java.lang.String contextPath, java.util.List<java.lang.String> trail, java.lang.String productId, java.lang.String productName, java.lang.String currentCategoryId, java.lang.String previousCategoryId)
Make product url according to the configurations.static java.lang.String
makeProductUrl(javax.servlet.http.HttpServletRequest request, java.lang.String productId, java.lang.String currentCategoryId, java.lang.String previousCategoryId)
Make product url according to the configurations.static java.lang.String
makeProductUrl(Delegator delegator, ProductContentWrapper wrapper, java.lang.String prefix, java.lang.String contextPath, java.lang.String currentCategoryId, java.lang.String previousCategoryId, java.lang.String productId)
This is used when building product url in services.
-
-
-
Field Detail
-
module
public static final java.lang.String module
-
URL_HYPHEN
public static final java.lang.String URL_HYPHEN
- See Also:
- Constant Field Values
-
-
Method Detail
-
getStringArg
public java.lang.String getStringArg(java.util.Map<?,?> args, java.lang.String key)
-
getWriter
public java.io.Writer getWriter(java.io.Writer out, java.util.Map args) throws freemarker.template.TemplateModelException, java.io.IOException
- Specified by:
getWriter
in interfacefreemarker.template.TemplateTransformModel
- Throws:
freemarker.template.TemplateModelException
java.io.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 java.util.Map<java.lang.String,java.lang.String> getCategoryNameIdMap()
Get the category name/id map.- Returns:
- the category name/id map
-
getCategoryIdNameMap
public static java.util.Map<java.lang.String,java.lang.String> getCategoryIdNameMap()
Get the category id/name map.- Returns:
- the category id/name map
-
initCategoryMap
public static void initCategoryMap(javax.servlet.http.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(javax.servlet.http.HttpServletRequest request, Delegator delegator)
-
makeProductUrl
public static java.lang.String makeProductUrl(javax.servlet.http.HttpServletRequest request, java.lang.String productId, java.lang.String currentCategoryId, java.lang.String previousCategoryId)
Make product url according to the configurations.- Returns:
- String a catalog url
-
makeCategoryUrl
public static java.lang.String makeCategoryUrl(javax.servlet.http.HttpServletRequest request, java.lang.String currentCategoryId, java.lang.String previousCategoryId, java.lang.String viewSize, java.lang.String viewIndex, java.lang.String viewSort, java.lang.String searchString)
Make category url according to the configurations.- Returns:
- String a category url
-
makeProductUrl
public static java.lang.String makeProductUrl(java.lang.String contextPath, java.util.List<java.lang.String> trail, java.lang.String productId, java.lang.String productName, java.lang.String currentCategoryId, java.lang.String previousCategoryId)
Make product url according to the configurations.- Returns:
- String a catalog url
-
getNiceName
protected static java.lang.String getNiceName(java.lang.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(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Delegator delegator) throws javax.servlet.ServletException, java.io.IOException
- Throws:
javax.servlet.ServletException
java.io.IOException
-
forwardProductUri
public static boolean forwardProductUri(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Delegator delegator, java.lang.String controlServlet) throws javax.servlet.ServletException, java.io.IOException
- Throws:
javax.servlet.ServletException
java.io.IOException
-
forwardUri
public static boolean forwardUri(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Delegator delegator, java.lang.String controlServlet) throws javax.servlet.ServletException, java.io.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:
javax.servlet.ServletException
java.io.IOException
-
forwardCategoryUri
public static boolean forwardCategoryUri(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Delegator delegator, java.lang.String controlServlet) throws javax.servlet.ServletException, java.io.IOException
Forward a category uri according to forward pattern regular expressions.- Parameters:
request
-response
-delegator
-controlServlet
-- Returns:
- Throws:
javax.servlet.ServletException
java.io.IOException
-
makeProductUrl
public static java.lang.String makeProductUrl(Delegator delegator, ProductContentWrapper wrapper, java.lang.String prefix, java.lang.String contextPath, java.lang.String currentCategoryId, java.lang.String previousCategoryId, java.lang.String productId)
This is used when building product url in services.- Parameters:
delegator
-wrapper
-prefix
-contextPath
-currentCategoryId
-previousCategoryId
-productId
-- Returns:
-
makeCategoryUrl
public static java.lang.String makeCategoryUrl(Delegator delegator, CategoryContentWrapper wrapper, java.lang.String prefix, java.lang.String currentCategoryId, java.lang.String previousCategoryId, java.lang.String productId, java.lang.String viewSize, java.lang.String viewIndex, java.lang.String viewSort, java.lang.String searchString)
This is used when building category url in services.- Parameters:
delegator
-wrapper
-prefix
-currentCategoryId
-previousCategoryId
-productId
-viewSize
-viewIndex
-viewSort
-searchString
-- Returns:
-
-