Interface PathProcessor
A service that can process a given path. This service is used by the
LinkManager to build the final
Link. The path processor chain of the link manager 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
Modifier and TypeMethodDescriptionbooleanaccepts(@NotNull String path, @NotNull SlingHttpServletRequest request) Checks if the given path should be handled by this processor.@NotNull Stringexternalize(@NotNull String path, @NotNull SlingHttpServletRequest request) Externalizes the given path.@NotNull Stringmap(@NotNull String path, @NotNull SlingHttpServletRequest request) Applies mappings to the given path.processHtmlAttributes(@NotNull String path, @Nullable Map<String, String> htmlAttributes) Processes the HTML attributes for theLinkManager@NotNull Stringsanitize(@NotNull String path, @NotNull SlingHttpServletRequest request) Sanitizes the given path by doing proper escaping and prepends the context path if needed.
-
Method Details
-
accepts
Checks if the given path should be handled by this processor.- Parameters:
path- the path which should be processedrequest- the current request- Returns:
trueif the processor should handle the given path, otherwisefalseand the next path processor is applied by theLinkManagerif 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 sanitizedrequest- 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 theResourceResolver.map(String)method.- Parameters:
path- the path which should be mappedrequest- 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 pathrequest- 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 theLinkManager- Parameters:
path- the path of the linked resourcehtmlAttributes- the origin HTML attributes of the link- Returns:
- a map of the processed HTML attributes for the link
-