Interface CatalogURLService
- All Known Implementing Classes:
CatalogURLServiceImpl
- Author:
- bpolster
- See Also:
-
org.broadleafcommerce.core.web.processor.CatalogRelativeHrefProcessor
-
Method Summary
Modifier and TypeMethodDescriptionbuildRelativeCategoryURL(String currentUrl, Category category) See similar description forbuildRelativeProductURL(String, Product)buildRelativeProductURL(String currentUrl, Product product) Provides relative URLs.
-
Method Details
-
buildRelativeProductURL
Provides relative URLs. This is useful for cases where a site wants to build a dynamic URL to get to a product or category where multiple navigation paths are provided.For example, consider a product with URL (/equipment/tennis-ball) that is in two categories which have the following URLs (/sports and /specials).
For some implementations, it is desirable to have two semantic URLs such as "/sports/tennis-ball" and "/specials/tennis-ball".
This method will take the last fragment of the product URL and append it to the passed in URL to make a relative URL.
This default implementation of this interface uses two system properties to control its behavior.
catalogUriService.appendIdToRelativeURI - If true (default), a query param will be appended to the URL with the productId.
catalogUriService.useUrlKey - If true (default is false), the implementation will call the ProductImpl.getUrlKey() to obtain the url fragment. If false, it will parse the last part of the ProductImpl.getUrl().
Returns the URL as a string including query parameters.
- Parameters:
currentUrl-product-- Returns:
-
buildRelativeCategoryURL
See similar description forbuildRelativeProductURL(String, Product)- Parameters:
currentUrl-category-- Returns:
-