You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Andreas Hartmann <an...@apache.org> on 2004/09/22 10:52:13 UTC

EnvironmentHelper.changeContext() adds trailing slash?

Hi Cocoon developers,

I just updated to 2.2-dev and got the following error:

The current URI 
(lenya-document-view/authoring/homepage/index/index_en.xml) doesn't 
start with given prefix (lenya-document-/)


Pipeline:

<map:match pattern="lenya-document-*/*/*/**.xml">
   <map:mount uri-prefix="lenya-document-"
              src="{fallback:doctypes.xmap}"
              .../>
</map:match>


The trace led me to EnvironmentHelper.changeContext():

// check for a slash at the beginning to avoid problems with subsitemaps
if ( buffer.charAt(buffer.length()-1) != '/') {
     buffer.append('/');
     this.lastPrefix = this.lastPrefix + '/';
}

I guess this is the code which adds the trailing slash (?)


Is it generally not possible to use a URI prefix for mounting
which does not end with a slash?

Thanks in advance!

-- Andreas


Re: EnvironmentHelper.changeContext() adds trailing slash?

Posted by Andreas Hartmann <an...@apache.org>.
Carsten Ziegeler wrote:
> Andreas Hartmann wrote: 

[...]

>>Is it generally not possible to use a URI prefix for mounting 
>>which does not end with a slash?
>>
> 
> No, it is not possible. The prefix has to end with a slash. If the
> user forgets the slash, Cocoon adds it. This is documented here:
> 
> http://cocoon.apache.org/2.1/userdocs/concepts/sitemap.html#Mounting+sitemap
> s

I see. Thanks a lot!

-- Andreas


RE: EnvironmentHelper.changeContext() adds trailing slash?

Posted by Carsten Ziegeler <cz...@apache.org>.
Andreas Hartmann wrote: 
> 
> Hi Cocoon developers,
> 
> I just updated to 2.2-dev and got the following error:
> 
> The current URI
> (lenya-document-view/authoring/homepage/index/index_en.xml) 
> doesn't start with given prefix (lenya-document-/)
> 
> 
> Pipeline:
> 
> <map:match pattern="lenya-document-*/*/*/**.xml">
>    <map:mount uri-prefix="lenya-document-"
>               src="{fallback:doctypes.xmap}"
>               .../>
> </map:match>
> 
> 
> The trace led me to EnvironmentHelper.changeContext():
> 
> // check for a slash at the beginning to avoid problems with 
> subsitemaps if ( buffer.charAt(buffer.length()-1) != '/') {
>      buffer.append('/');
>      this.lastPrefix = this.lastPrefix + '/'; }
> 
> I guess this is the code which adds the trailing slash (?)
> 
Yes.

> 
> Is it generally not possible to use a URI prefix for mounting 
> which does not end with a slash?
> 
No, it is not possible. The prefix has to end with a slash. If the
user forgets the slash, Cocoon adds it. This is documented here:

http://cocoon.apache.org/2.1/userdocs/concepts/sitemap.html#Mounting+sitemap
s

Carsten