Class UrlProviderImpl
- java.lang.Object
-
- com.adobe.cq.commerce.core.components.internal.services.UrlProviderImpl
-
- All Implemented Interfaces:
UrlProvider
public class UrlProviderImpl extends Object implements UrlProvider
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.adobe.cq.commerce.core.components.services.UrlProvider
UrlProvider.CategoryIdentifierType, UrlProvider.IdentifierLocation, UrlProvider.ParamsBuilder, UrlProvider.ProductIdentifierType
-
-
Field Summary
-
Fields inherited from interface com.adobe.cq.commerce.core.components.services.UrlProvider
ID_PARAM, PAGE_PARAM, SKU_PARAM, UID_PARAM, URL_KEY_PARAM, URL_PATH_PARAM, VARIANT_SKU_PARAM, VARIANT_URL_KEY_PARAM
-
-
Constructor Summary
Constructors Constructor Description UrlProviderImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activate(UrlProviderConfiguration conf)
org.apache.commons.lang3.tuple.Pair<UrlProvider.CategoryIdentifierType,String>
getCategoryIdentifier(org.apache.sling.api.SlingHttpServletRequest request)
Returns the type and value of the category identifier used in the given Sling HTTP request.org.apache.commons.lang3.tuple.Pair<UrlProvider.ProductIdentifierType,String>
getProductIdentifier(org.apache.sling.api.SlingHttpServletRequest request)
Returns the type and value of the product identifier used in the given Sling HTTP request.String
toCategoryUrl(org.apache.sling.api.SlingHttpServletRequest request, com.day.cq.wcm.api.Page page, Map<String,String> params)
Returns the category page URL.String
toProductUrl(org.apache.sling.api.SlingHttpServletRequest request, com.day.cq.wcm.api.Page page, Map<String,String> params)
Returns the product page URL.static org.apache.sling.api.resource.Resource
toSpecificPage(org.apache.sling.api.resource.Resource page, Set<String> selectors)
This method checks if any of the children of the givenpage
resource is a page with aselectorFilter
property set with the value of the givenselector
.static org.apache.sling.api.resource.Resource
toSpecificPage(org.apache.sling.api.resource.Resource page, Set<String> selectors, org.apache.sling.api.SlingHttpServletRequest request)
This method checks if any of the children of the givenpage
resource is a page with aselectorFilter
property set with the value of the givenselector
.
-
-
-
Method Detail
-
activate
public void activate(UrlProviderConfiguration conf)
-
toProductUrl
public String toProductUrl(org.apache.sling.api.SlingHttpServletRequest request, com.day.cq.wcm.api.Page page, Map<String,String> params)
Description copied from interface:UrlProvider
Returns the product page URL.- Specified by:
toProductUrl
in interfaceUrlProvider
- Parameters:
request
- The current Sling HTTP request.page
- The target page, if any. This parameter can be null if the URL template does not use the${page}
parameter.params
- The parameters used in the URL template.- Returns:
- The product URL.
-
toCategoryUrl
public String toCategoryUrl(org.apache.sling.api.SlingHttpServletRequest request, com.day.cq.wcm.api.Page page, Map<String,String> params)
Description copied from interface:UrlProvider
Returns the category page URL.- Specified by:
toCategoryUrl
in interfaceUrlProvider
- Parameters:
request
- The current Sling HTTP request.page
- The target page, if any. This parameter can be null if the URL template does not use the${page}
parameter.params
- The parameters used in the URL template.- Returns:
- The category URL.
-
toSpecificPage
public static org.apache.sling.api.resource.Resource toSpecificPage(org.apache.sling.api.resource.Resource page, Set<String> selectors)
This method checks if any of the children of the givenpage
resource is a page with aselectorFilter
property set with the value of the givenselector
.- Parameters:
page
- The page resource, from where children pages will be checked.selectors
- The searched value for theselectorFilter
property.- Returns:
- If found, a child page resource that contains the given
selectorFilter
value. If not found, this method returns null.
-
toSpecificPage
public static org.apache.sling.api.resource.Resource toSpecificPage(org.apache.sling.api.resource.Resource page, Set<String> selectors, org.apache.sling.api.SlingHttpServletRequest request)
This method checks if any of the children of the givenpage
resource is a page with aselectorFilter
property set with the value of the givenselector
.- Parameters:
page
- The page resource, from where children pages will be checked.selectors
- The searched value for theselectorFilter
property.request
- The current Sling HTTP Servlet request.- Returns:
- If found, a child page resource that contains the given
selectorFilter
value. If not found, this method returns null.
-
getProductIdentifier
public org.apache.commons.lang3.tuple.Pair<UrlProvider.ProductIdentifierType,String> getProductIdentifier(org.apache.sling.api.SlingHttpServletRequest request)
Description copied from interface:UrlProvider
Returns the type and value of the product identifier used in the given Sling HTTP request.- Specified by:
getProductIdentifier
in interfaceUrlProvider
- Parameters:
request
- The current Sling HTTP request.- Returns:
- The type and value of the product identifier.
-
getCategoryIdentifier
public org.apache.commons.lang3.tuple.Pair<UrlProvider.CategoryIdentifierType,String> getCategoryIdentifier(org.apache.sling.api.SlingHttpServletRequest request)
Description copied from interface:UrlProvider
Returns the type and value of the category identifier used in the given Sling HTTP request.- Specified by:
getCategoryIdentifier
in interfaceUrlProvider
- Parameters:
request
- The current Sling HTTP request.- Returns:
- The type and value of the category identifier.
-
-