You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by "Simone Gianni (JIRA)" <ji...@apache.org> on 2006/10/30 19:12:17 UTC
[jira] Created: (COCOON-1945) Mounting the same subsitemap multiple
time, but with different prefixes, causes an error
Mounting the same subsitemap multiple time, but with different prefixes, causes an error
----------------------------------------------------------------------------------------
Key: COCOON-1945
URL: http://issues.apache.org/jira/browse/COCOON-1945
Project: Cocoon
Issue Type: Bug
Components: * Cocoon Core
Affects Versions: 2.2-dev (Current SVN)
Reporter: Simone Gianni
Suppose I have a subsitemap that generates XML documents, and then i want to mount it with different prefixes. For example :
<map:match pattern="*/doc/**">
<map:action ......>
<map:mount src="mysubfolder" location="{1}"/>
</map:match>
<map:match pattern="something/*/**">
<map:generate src="cocoon://{1}/doc/{2}"/>
<map:transform src="cocoon://otherprefix/doc/somethingelse"/>
....
The second call with cocoon:// fails with the cause that "/otherprefix/docs/blabla does not start with /originalprefix/".
This is because in MountNode getProcessor() the TreeProcessors are cached based on their source (mysubfolder/sitemap.xmap), but not regarding their prefix.
I "solved" this using also the prefix in the cache key :
Index: src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java
===================================================================
--- src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java (revision 449416)
+++ src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java (working copy)
@@ -135,13 +135,13 @@
private synchronized TreeProcessor getProcessor(String source, String prefix)
throws Exception {
- TreeProcessor processor = (TreeProcessor) processors.get(source);
+ TreeProcessor processor = (TreeProcessor) processors.get(source + "||" + prefix);
if (processor == null) {
processor = this.parentProcessor.createChildProcessor(source, this.checkReload, prefix);
// Associate to the original source
- processors.put(source, processor);
+ processors.put(source + "||" + prefix, processor);
}
return processor;
But this means that two tree processors gets generated to represent the same sitemap, with only the prefix changing. I'm sure that there is a best way to do it.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (COCOON-1945) Mounting the same subsitemap
multiple time, but with different prefixes, causes an error
Posted by "Simone Gianni (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/COCOON-1945?page=comments#action_12455214 ]
Simone Gianni commented on COCOON-1945:
---------------------------------------
Also, connected to this one, there is the way the ConcreteTreeProcessor checks which processor should execute a certain sitemap. I don't understand the newEnv.getURIPrefix().equals("") thing, because if i have a mount like this :
<map:mount src="mysubsitemap" prefix=""/>
It then reroutes cocoon:/ inside mysubsitemap to the root one, which is IMO wrong.
Since there is another way (the way used inthe SitemapSource) to check wether a cocoon: uri has to go to the root or not, why not use it?
Index: core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java
===================================================================
--- core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java (revision 449416)
+++ core/cocoon-core/src/main/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java (working copy)
@@ -299,7 +299,7 @@
// Get the processor that should process this request
ConcreteTreeProcessor processor;
- if (newEnv.getURIPrefix().equals("")) {
+ if (info.processFromRoot) {
processor = ((TreeProcessor)getRootProcessor()).concreteProcessor;
} else {
processor = this;
> Mounting the same subsitemap multiple time, but with different prefixes, causes an error
> ----------------------------------------------------------------------------------------
>
> Key: COCOON-1945
> URL: http://issues.apache.org/jira/browse/COCOON-1945
> Project: Cocoon
> Issue Type: Bug
> Components: * Cocoon Core
> Affects Versions: 2.2-dev (Current SVN)
> Reporter: Simone Gianni
>
> Suppose I have a subsitemap that generates XML documents, and then i want to mount it with different prefixes. For example :
> <map:match pattern="*/doc/**">
> <map:action ......>
> <map:mount src="mysubfolder" location="{1}"/>
> </map:match>
> <map:match pattern="something/*/**">
> <map:generate src="cocoon://{1}/doc/{2}"/>
> <map:transform src="cocoon://otherprefix/doc/somethingelse"/>
> ....
> The second call with cocoon:// fails with the cause that "/otherprefix/docs/blabla does not start with /originalprefix/".
> This is because in MountNode getProcessor() the TreeProcessors are cached based on their source (mysubfolder/sitemap.xmap), but not regarding their prefix.
> I "solved" this using also the prefix in the cache key :
> Index: src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java
> ===================================================================
> --- src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java (revision 449416)
> +++ src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java (working copy)
> @@ -135,13 +135,13 @@
> private synchronized TreeProcessor getProcessor(String source, String prefix)
> throws Exception {
> - TreeProcessor processor = (TreeProcessor) processors.get(source);
> + TreeProcessor processor = (TreeProcessor) processors.get(source + "||" + prefix);
> if (processor == null) {
> processor = this.parentProcessor.createChildProcessor(source, this.checkReload, prefix);
> // Associate to the original source
> - processors.put(source, processor);
> + processors.put(source + "||" + prefix, processor);
> }
> return processor;
> But this means that two tree processors gets generated to represent the same sitemap, with only the prefix changing. I'm sure that there is a best way to do it.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Updated: (COCOON-1945) Mounting the same subsitemap multiple
time, but with different prefixes, causes an error
Posted by "Simone Gianni (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COCOON-1945?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Simone Gianni updated COCOON-1945:
----------------------------------
Attachment: patch-1945.diff
The new patch, cause files were moved since when i opened this bug.
> Mounting the same subsitemap multiple time, but with different prefixes, causes an error
> ----------------------------------------------------------------------------------------
>
> Key: COCOON-1945
> URL: https://issues.apache.org/jira/browse/COCOON-1945
> Project: Cocoon
> Issue Type: Bug
> Components: * Cocoon Core
> Affects Versions: 2.2-dev (Current SVN)
> Reporter: Simone Gianni
> Attachments: patch-1945.diff
>
>
> Suppose I have a subsitemap that generates XML documents, and then i want to mount it with different prefixes. For example :
> <map:match pattern="*/doc/**">
> <map:action ......>
> <map:mount src="mysubfolder" location="{1}"/>
> </map:match>
> <map:match pattern="something/*/**">
> <map:generate src="cocoon://{1}/doc/{2}"/>
> <map:transform src="cocoon://otherprefix/doc/somethingelse"/>
> ....
> The second call with cocoon:// fails with the cause that "/otherprefix/docs/blabla does not start with /originalprefix/".
> This is because in MountNode getProcessor() the TreeProcessors are cached based on their source (mysubfolder/sitemap.xmap), but not regarding their prefix.
> I "solved" this using also the prefix in the cache key :
> Index: src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java
> ===================================================================
> --- src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java (revision 449416)
> +++ src/main/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java (working copy)
> @@ -135,13 +135,13 @@
> private synchronized TreeProcessor getProcessor(String source, String prefix)
> throws Exception {
> - TreeProcessor processor = (TreeProcessor) processors.get(source);
> + TreeProcessor processor = (TreeProcessor) processors.get(source + "||" + prefix);
> if (processor == null) {
> processor = this.parentProcessor.createChildProcessor(source, this.checkReload, prefix);
> // Associate to the original source
> - processors.put(source, processor);
> + processors.put(source + "||" + prefix, processor);
> }
> return processor;
> But this means that two tree processors gets generated to represent the same sitemap, with only the prefix changing. I'm sure that there is a best way to do it.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.