Interface CatalogURLService

All Known Implementing Classes:
CatalogURLServiceImpl

public interface CatalogURLService
This service provides some URL manipulation capabilities. Initially provided to support the creation of relative URLs and Breadcrumb requirements.
Author:
bpolster
See Also:
  • org.broadleafcommerce.core.web.processor.CatalogRelativeHrefProcessor
  • Method Details

    • buildRelativeProductURL

      String buildRelativeProductURL(String currentUrl, Product product)
      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

      String buildRelativeCategoryURL(String currentUrl, Category category)
      See similar description for buildRelativeProductURL(String, Product)
      Parameters:
      currentUrl -
      category -
      Returns: