You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Carsten Ziegeler (Jira)" <ji...@apache.org> on 2025/05/04 19:22:00 UTC
[jira] [Comment Edited] (SLING-12764) Add API to getALL Vanity Paths
[ https://issues.apache.org/jira/browse/SLING-12764?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17949333#comment-17949333 ]
Carsten Ziegeler edited comment on SLING-12764 at 5/4/25 7:21 PM:
------------------------------------------------------------------
Wouldn't it be easier to have an endpoint that can be called by the downstream system for every path - and that endpoint simply uses RR.resolve to determine whether it is a vanity path? (or uses aliases which I assume will be another problem you might hit)
As [~reschke]points out, today the information of *all* vanity paths might not be available
was (Author: cziegeler):
Wouldn't it be easier to have an endpoint that can be called by the downstream system for every path - and that endpoint simply uses RR.resolve to determine whether it is a vanity path? (or uses aliases which I assume will be another problem you might hit)
As [~reschke] today the information of *all* vanity paths might not be available
> Add API to getALL Vanity Paths
> ------------------------------
>
> Key: SLING-12764
> URL: https://issues.apache.org/jira/browse/SLING-12764
> Project: Sling
> Issue Type: Improvement
> Components: API, ResourceResolver
> Reporter: Abhishek Garg
> Priority: Major
>
> *Summary*
> Introduce a new API method in the An {{ResourceResolver}} interface to expose vanity path mappings that are already calculated and cached internally.
> ----
> *Description*
> Currently, the {{ResourceResolver}} calculates and caches all vanity paths internally (see {{MapEntries.initializeVanityPaths()}} and {{{}VanityPathHandler{}}}), controlled by the configuration property {{{}resource.resolver.vanity.paths.enabled{}}}.
> However, downstream systems that require access to vanity paths must *recalculate* them independently, resulting in:
> * *Duplicate computation* — The same JCR query is executed multiple times.
> * *Increased memory usage* — Multiple caches holding the same data.
> * *Potential inconsistencies* — Different systems might process vanity paths differently.
> ----
> *Proposed Solution*
> Expose the existing vanity path cache through a new method in the {{ResourceResolver}} interface:
> /**
> * Returns a mapping from vanity paths to their corresponding target resource paths.
> *
> * @return An unmodifiable map of vanity paths to their target resource paths, or an empty map if vanity paths are disabled.
> * @since 2.28.0 (or the next appropriate version)
> */
> Map<String, List<String>> getVanityPathMappings();
>
> The {{ResourceResolverImpl}} would implement this by returning a view of internal maintenance cache
> ----
> *Benefits*
> * *Reduces system resource usage* by eliminating redundant calculations.
> * *Ensures a consistent view* of vanity paths across all components.
> * *Simplifies implementation* of downstream systems that depend on vanity path data.
> * *Enables more efficient architectures* by leveraging already computed and cached information.
> ----
> *Repositories Impacted*
> * [{{sling-org-apache-sling-api}}|https://github.com/apache/sling-org-apache-sling-api]
> * [{{sling-org-apache-sling-resourceresolver}}|https://github.com/apache/sling-org-apache-sling-resourceresolver]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)