cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gianugo Rabellino <gian...@apache.org>
Subject Nasty flowscript issue - nailed
Date Mon, 05 Jul 2004 21:16:09 GMT
We had an interesting night here, dealing with a really nasty  
flowscript issue  
(http://marc.theaimsgroup.com/?t=108798488500001&r=1&w=2). Thanks to  
the precious help of Jerm, Andrew and Paul Russell, our small hackaton  
seemed to be successful in at least nailing the issue.

So, there you go: you have different sitemaps, dealing with different  
flowscripts each BUT all residing in the same directory and mounted  
using uri-prefix as follows:

<map:mount src="something.xmap" uri-prefix="something"  
check-reloads="true"/>

<map:mount src="else.xmap" uri-prefix="else" check-reloads="true"/>

In that case, FOM_JavaScriptInterpreter screws up because of scope  
handling: scopes are kept in memory and indexed using a string coming  
from the internal getSitemapPath() function call which, a bit naively,  
is as follows:

    private String getSitemapPath() throws Exception {
         Source src = this.sourceresolver.resolveURI(".");
         try {
             return src.getURI();
         } finally {
             this.sourceresolver.release(src);
         }
     }

Now, whether you ask for /url /something/url or /else/url, that method  
will always return file://$COCOON_HOME/build/webapp/. This means that  
the list of available functions will always point to the first set of  
scripts being evaluated, and on your subsequent requests to seemingly  
different URLs you get a nice function not found error.

I changed that to

    private String getSitemapPath() throws Exception {
         return ObjectModelHelper.getRequest(
		 
EnvironmentHelper.getCurrentEnvironment().getObjectModel()).getSitemapUR 
I();
     }

but being a freshman on Cocoon flow internals, I'm afraid this is going  
to introduce a nasty set of regressions. Can anyone more knowleadgeable  
verify the problem and possibly provide a more clever solution?

TIA,
-- 
Gianugo Rabellino
Pro-netics s.r.l. -  http://www.pro-netics.com
Orixo, the XML business alliance: http://www.orixo.com


Mime
View raw message