Interface PathProcessor
-
@ConsumerType public interface PathProcessor
A service that can process a given path. This service is used by theLinkManager
to build the finalLink
. 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 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 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 theLinkManager
@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 processedrequest
- the current request- Returns:
true
if the processor should handle the given path, otherwisefalse
and the next path processor is applied by theLinkManager
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 sanitizedrequest
- 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 theResourceResolver.map(String)
method.- Parameters:
path
- the path which should be mappedrequest
- 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 pathrequest
- 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 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
-
-