Interface PathProcessor


  • @ConsumerType
    public interface PathProcessor
    A service that can process a given path. This service is used by the LinkHandler to build the final Link. The path processor chain of the Link Handler can be extended by a custom path processor which has to get a higher service ranking than the DefaultPathProcessor.
    Since:
    com.adobe.cq.wcm.core.components.services.link 1.0.0
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      boolean accepts​(@NotNull java.lang.String path, @NotNull SlingHttpServletRequest request)
      Checks if the given path should be handled by this processor.
      @NotNull java.lang.String externalize​(@NotNull java.lang.String path, @NotNull SlingHttpServletRequest request)
      Externalizes the given path.
      @NotNull java.lang.String map​(@NotNull java.lang.String path, @NotNull SlingHttpServletRequest request)
      Applies mappings to the given path.
      default @Nullable java.util.Map<java.lang.String,​java.lang.String> processHtmlAttributes​(@NotNull java.lang.String path, @Nullable java.util.Map<java.lang.String,​java.lang.String> htmlAttributes)
      Processes the HTML attributes for the LinkHandler
      @NotNull java.lang.String sanitize​(@NotNull java.lang.String path, @NotNull SlingHttpServletRequest request)
      Sanitizes the given path by doing proper escaping and prepends the context path if needed.
    • Method Detail

      • accepts

        boolean accepts​(@NotNull
                        @NotNull java.lang.String path,
                        @NotNull
                        @NotNull SlingHttpServletRequest request)
        Checks if the given path should be handled by this processor.
        Parameters:
        path - the path which should be processed
        request - the current request
        Returns:
        true if the processor should handle the given path, otherwise false and the next path processor is applied by the LinkHandler if present
      • sanitize

        @NotNull
        @NotNull java.lang.String sanitize​(@NotNull
                                           @NotNull java.lang.String path,
                                           @NotNull
                                           @NotNull SlingHttpServletRequest request)
        Sanitizes the given path by doing proper escaping and prepends the context path if needed.
        Parameters:
        path - the path which needs to be sanitized
        request - the current request
        Returns:
        the escaped absolute path with optional context path information
      • map

        @NotNull
        @NotNull java.lang.String map​(@NotNull
                                      @NotNull java.lang.String path,
                                      @NotNull
                                      @NotNull SlingHttpServletRequest request)
        Applies mappings to the given path. Usually this is done with the ResourceResolver.map(String) method.
        Parameters:
        path - the path which should be mapped
        request - the current request
        Returns:
        the mapped path
      • externalize

        @NotNull
        @NotNull java.lang.String externalize​(@NotNull
                                              @NotNull java.lang.String path,
                                              @NotNull
                                              @NotNull SlingHttpServletRequest request)
        Externalizes the given path.
        Parameters:
        path - the resource path
        request - the current request
        Returns:
        the external link of the given path
      • processHtmlAttributes

        @Nullable
        default @Nullable java.util.Map<java.lang.String,​java.lang.String> processHtmlAttributes​(@NotNull
                                                                                                       @NotNull java.lang.String path,
                                                                                                       @Nullable
                                                                                                       @Nullable java.util.Map<java.lang.String,​java.lang.String> htmlAttributes)
        Processes the HTML attributes for the LinkHandler
        Parameters:
        path - the path of the linked resource
        htmlAttributes - the origin HTML attributes of the link
        Returns:
        a map of the processed HTML attributes for the link