Interface ModelPathMapper


@ProviderType public interface ModelPathMapper
An interface providing methods that are capable of mapping resource paths in the repository to and from resource paths in the HTTP APIs URI space. One mapper is allowed per category.
  • Method Summary

    Modifier and Type
    Method
    Description
    map(String resourcePath)
    Converts a resource path to a path in the API space.
    unmap(String apiPath)
    Converts an API path to a path in the content space.
  • Method Details

    • map

      @Nonnull String map(String resourcePath)
      Converts a resource path to a path in the API space. For example in assets jcr:content is removed from the URL in certain places this adds it back.
       String path = resourcePath;
       if (path != null && path.matches(".*?/jcr:content/(associated|model|variations).*")) {
           path = path.replaceFirst("jcr:content/((associated|model|variations)", "$1");
           return path;
       }
       
      Parameters:
      resourcePath - the resource path to map
      Returns:
      the mapped resource path
    • unmap

      @Nonnull String unmap(String apiPath)
      Converts an API path to a path in the content space. For example in assets jcr:content is added back to the URL under certain paths:
       String path = apiPath;
       if (path != null && path.matches(".*?/(associated|model|variations).*")) {
           return path.replaceFirst("(associated|model|variations)", "jcr:content/$1");
       }
       return path;
       
      Parameters:
      apiPath - the api path to unmap
      Returns:
      the unmapped api path