I just tried to write an Component under Cocoon 2.1.5. and Tomcat 5.0.25
public class DocumentManagerXML implements DocumentManager, ThreadSafe, Component, Serviceable, Parameterizable, LogEnabled, Initializable, Disposable
This class should read a File when it is initialized... so implemented the Interface Initializable an redeclared the function like this...
public void initialize() throws Exception {
SourceResolver sourceResolver = null;
Source src = null;
try{
.....sourceResolver = (SourceResolver)this.serviceManager.lookup(SourceResolver.ROLE);
src = sourceResolver.resolveURI("cms/navigation/navigation.xml");
.....
String path = SourceUtil.getPath(src); // Here the path looks like /D:/tomcat5/bin/cms/navigation/navigation.xml
.....
}catch{
.....
}finally{
-----
}
}But this is not the Result i expected... so i wrote a function like this.. called from within JavaFlow...
public Document getDocument(){
SourceResolver sourceResolver = null;
Source src = null;
try{
.....sourceResolver = (SourceResolver)this.serviceManager.lookup(SourceResolver.ROLE);
src = sourceResolver.resolveURI("cms/navigation/navigation.xml");
.....
String path = SourceUtil.getPath(src); // Here the path looks like /D:/tomcat5/webapp/ROOT/cms/navigation/navigation.xml
.....
}catch{
.....
}finally{
-----
}
}I think i does not make a sense, a functions doing the same thing (of course at different times) are returning different values... I think this is a bug... because the SourceResolver cannot lookup URLs from within the Initialize Method.. or is there a workaround for that ?
Thanks
Andreas Schmid
