cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Hartmann <andr...@apache.org>
Subject Re: cocoon:/ protocol bug in 2.2?
Date Wed, 22 Sep 2004 17:19:35 GMT
Vadim Gritsenko wrote:
> Andreas Hartmann wrote:
> 
>> - 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?
> 
> 
> Yes, it should be. Can you make a patch fixing it? :)

It seems that the SitemapSource cannot rely on the
SitemapSourceInfo.prefix to determine the target processor.

That's why I would add a boolean field

   SitemapSourceInfo.processFromRoot


// does the uri point to this sitemap or to the root sitemap?
if (sitemapURI.startsWith("//", position)) {
     position += 2;
     info.processFromRoot = true;
     info.prefix = "";
} else if (sitemapURI.startsWith("/", position)) {
     position ++;
     info.processFromRoot = false;
     info.prefix = env.getURIPrefix();
} else {
     throw new MalformedURLException("Malformed cocoon URI: " + sitemapURI);
}


SitemapSource:

// does the uri point to this sitemap or to the root sitemap?
if (info.processFromRoot) {
     this.processor = 
EnvironmentHelper.getCurrentProcessor().getRootProcessor();
} else {
     this.processor = EnvironmentHelper.getCurrentProcessor();
}


That seems to do the trick, at least in my application.
If you think it is appropriate and sufficient, I'll
commit it to the trunk.

-- Andreas


Mime
View raw message