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

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.String map​(java.lang.String resourcePath)
      Converts a resource path to a path in the API space.
      java.lang.String unmap​(java.lang.String apiPath)
      Converts an API path to a path in the content space.
    • Method Detail

      • map

        @Nonnull
        java.lang.String map​(java.lang.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
        java.lang.String unmap​(java.lang.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