Nicola Ken Barozzi wrote:
I've updated Cocoon to use 2.2-dev to test the new pass-through stuff, and one thing is not working as before. In a subsitemap, I do a cocoon:/ call and it does not work. It works when I put the things to call in the base sitemap, but wasn't that cocoon:// (which BTW seems to work correctly)?
I can confirm the problem.
Test case: Lenya 1.4-dev (trunk) with Cocoon 2.2 (trunk)
The sub-sitemap is mounted using
<map:match pattern="*/*/info-sitetree/**"> <map:mount uri-prefix="" src="lenya/info.xmap" check-reload="true" reload-method="synchron"/> </map:match>
(BTW, is it allowed to have an empty URI prefix here? Carsten just told me it has to end with a slash)
The cocoon:/ call in info.xmap
<map:match pattern="*/*/info-sitetree/sitetree.js"> <map:aggregate element="lenya" label="aggregate"> <map:part src="cocoon:/{1}/authoring/sitetree.xml"/> ...
goes directly to the root sitemap instead of staying in info.xmap.
I think I tracked it down.
--------------------------------------------------------
SitemapSourceInfo.parseURI() (I added some logging):
// does the uri point to this sitemap or to the root sitemap? if (sitemapURI.startsWith("//", position)) { position += 2; info.prefix = ""; // start at the root } else if (sitemapURI.startsWith("/", position)) { position ++; info.prefix = env.getURIPrefix(); } else { throw new MalformedURLException("Malformed cocoon URI: " + sitemapURI); }
logger.debug("Sitemap URI: [" + sitemapURI + "]");
logger.debug("URI prefix: [" + env.getURIPrefix() + "]");
logger.debug("Prefix: [" + info.prefix + "]");--------------------------------------------------------
results in:
SitemapSourceInfo: Sitemap URI: [cocoon:/default/trash/sitetree.xml] SitemapSourceInfo: URI prefix: [] SitemapSourceInfo: Prefix: []
I guess the URI prefix is empty because the sitemap was mounted using an empty URI prefix.
--------------------------------------------------------
SitemapSource:
// does the uri point to this sitemap or to the root sitemap?
if (info.prefix.length() == 0) {
this.processor = EnvironmentHelper.getCurrentProcessor().getRootProcessor();
} else {
this.processor = EnvironmentHelper.getCurrentProcessor();
}
--------------------------------------------------------
This means the root sitemap processor is used.
Some questions:
- Is this behaviour intended?
- Is it allowed to mount sitemaps with an empty URI prefix? If not, the problem will not appear. If yes, what can I do about it?
Thanks in advance, -- Andreas
