Interface PathProcessor
-
@ConsumerType public interface PathProcessor
A service that can process a given path. This service is used by theLinkHandler
to build the finalLink
. 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 theDefaultPathProcessor
.- 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 String path, @NotNull SlingHttpServletRequest request)
Checks if the given path should be handled by this processor.@NotNull String
externalize(@NotNull String path, @NotNull SlingHttpServletRequest request)
Externalizes the given path.@NotNull String
map(@NotNull String path, @NotNull SlingHttpServletRequest request)
Applies mappings to the given path.default @Nullable Map<String,String>
processHtmlAttributes(@NotNull String path, @Nullable Map<String,String> htmlAttributes)
Process the HTML attributes for theLinkHandler
@NotNull String
sanitize(@NotNull 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 String path, @NotNull @NotNull SlingHttpServletRequest request)
Checks if the given path should be handled by this processor.- Parameters:
path
- the path which should be processedrequest
- the current request- Returns:
true
if the processor should handle the given path, otherwisefalse
and the next path processor is applied by theLinkHandler
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 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)
Process the HTML attributes for theLinkHandler
- 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
-
-