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 Detail

      • accepts

        boolean accepts​(@NotNull
                        @NotNull 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 String sanitize​(@NotNull
                                 @NotNull 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 String map​(@NotNull
                            @NotNull 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 String externalize​(@NotNull
                                    @NotNull 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 Map<String,​String> processHtmlAttributes​(@NotNull
                                                                         @NotNull String path,
                                                                         @Nullable
                                                                         @Nullable Map<String,​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