Interface UrlProvider
-
- All Known Implementing Classes:
UrlProviderImpl
public interface UrlProvider
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
UrlProvider.CategoryIdentifierType
Defines the category identifier type used in category page urls.static class
UrlProvider.IdentifierLocation
Defines the location of the product or ctegory identifier in the URL.static class
UrlProvider.ParamsBuilder
A helper class used to easily build parameters for the URL templates.static class
UrlProvider.ProductIdentifierType
Defines the product identifier type used in product page urls.
-
Field Summary
Fields Modifier and Type Field Description static String
ID_PARAM
Theid
of the category.static String
PAGE_PARAM
Use this parameter name to set the page part of the URL.static String
SKU_PARAM
Thesku
parameter of the product.static String
UID_PARAM
Theuid
of the category.static String
URL_KEY_PARAM
Theurl_key
parameter of the product or category.static String
URL_PATH_PARAM
Theurl_path
parameter of the product or category.static String
VARIANT_SKU_PARAM
In the case of aConfigurableProduct
, thevariant_sku
parameter must be set to the sku of the currently selected/chosen variant.static String
VARIANT_URL_KEY_PARAM
In the case of aConfigurableProduct
, thevariant_url_key
parameter must be set to the url_key of the currently selected/chosen variant.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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.
-
-
-
Field Detail
-
URL_KEY_PARAM
static final String URL_KEY_PARAM
Theurl_key
parameter of the product or category. In the case of aConfigurableProduct
, this must hold the url_key of the configurable product and the variant url_key must be set with thevariant_url_key
parameter.- See Also:
- Constant Field Values
-
URL_PATH_PARAM
static final String URL_PATH_PARAM
Theurl_path
parameter of the product or category.- See Also:
- Constant Field Values
-
SKU_PARAM
static final String SKU_PARAM
Thesku
parameter of the product. In the case of aConfigurableProduct
, this must hold the sku of the configurable product and the variant sku must be set with thevariant_sku
parameter.- See Also:
- Constant Field Values
-
VARIANT_SKU_PARAM
static final String VARIANT_SKU_PARAM
In the case of aConfigurableProduct
, thevariant_sku
parameter must be set to the sku of the currently selected/chosen variant.- See Also:
- Constant Field Values
-
VARIANT_URL_KEY_PARAM
static final String VARIANT_URL_KEY_PARAM
In the case of aConfigurableProduct
, thevariant_url_key
parameter must be set to the url_key of the currently selected/chosen variant.- See Also:
- Constant Field Values
-
ID_PARAM
static final String ID_PARAM
Theid
of the category.- See Also:
- Constant Field Values
-
UID_PARAM
static final String UID_PARAM
Theuid
of the category.- See Also:
- Constant Field Values
-
PAGE_PARAM
static final String PAGE_PARAM
Use this parameter name to set the page part of the URL. This ensures that implementations of the UrlProvider can easily "find out" if the page part of the URL is being statically set.- See Also:
- Constant Field Values
-
-
Method Detail
-
toProductUrl
String toProductUrl(org.apache.sling.api.SlingHttpServletRequest request, @Nullable com.day.cq.wcm.api.Page page, Map<String,String> params)
Returns the product page URL.- 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
String toCategoryUrl(org.apache.sling.api.SlingHttpServletRequest request, com.day.cq.wcm.api.Page page, Map<String,String> params)
Returns the category page URL.- 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.
-
getProductIdentifier
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.- Parameters:
request
- The current Sling HTTP request.- Returns:
- The type and value of the product identifier.
-
getCategoryIdentifier
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.- Parameters:
request
- The current Sling HTTP request.- Returns:
- The type and value of the category identifier.
-
-