in src/main/java/org/apache/sling/sitemap/impl/SitemapServlet.java [130:156]
protected void doGetSitemapIndex(@NotNull SlingHttpServletRequest request,
@NotNull SlingHttpServletResponse response,
Resource topLevelSitemapRoot) throws IOException, SitemapException {
// when sitemaps may be served on demand, we have to query for the sitemap roots of the current resource,
// otherwise we can simply get the top level's storage path and serve all sitemaps in there
SitemapIndexImpl sitemapIndex = new SitemapIndexImpl(response.getWriter());
Set<String> addedSitemapSelectors = addOnDemandSitemapsToIndex(request, topLevelSitemapRoot, sitemapIndex);
// add any sitemap from the storage
for (SitemapStorageInfo storageInfo : storage.getSitemaps(topLevelSitemapRoot)) {
if (!addedSitemapSelectors.contains(storageInfo.getSitemapSelector())) {
String location = externalize(request,
getSitemapLink(topLevelSitemapRoot, storageInfo.getSitemapSelector()));
Calendar lastModified = storageInfo.getLastModified();
if (location != null && lastModified != null) {
sitemapIndex.addSitemap(location, lastModified.toInstant());
} else if (location != null) {
sitemapIndex.addSitemap(location);
} else {
LOG.debug("Could not get absolute url for sitemap served from {}",
storageInfo.getSitemapSelector());
}
}
}
sitemapIndex.close();
}