eg: in your webapp's sitemap you use "pages/mywelcomepage.xml"
mywebapp/pages/mywelcomepage.xml mywebapp/sitemap.xmap
then resolving will add the whole path /.../mywebapp/ in front of your relative path "pages/mywelcomepage.xml".
I tend to use a simple function for this in my flowscript:
function resolveToFile(uri)
{
var resolver = null;
var filesource = null;
try
{
resolver = cocoon.getComponent(Packages.org.apache.cocoon.environment.SourceResolver.ROLE);
filesource = resolver.resolveURI(uri);
var file = new java.io.File(new java.net.URI(filesource.getURI()));
return file;
}
finally
{
if(filesource != null) resolver.release(filesource);
cocoon.releaseComponent(resolver);
}
}
Kind Regards, Jan
Marc Salvetti wrote:
Hello,
i'm trying to access some of the xml files in my webapp directly from the flowscript for creation/deletion
i can't find a way to adress the correct directory of the servlet
i tried request:contextPath but it gives only a partial path, i also tried servletPath but it gives the uri of the calling page
what i'd like to do look like this :
var path = contextPath + "/cfm/xdocs/planning/cruise7.xml"; var file = new Packages.java.io.File( path); if(!file.isFile()){print(file.getCanonicalPath());}
Does anyone have a working example of how to get the full path of the directory where my xml files are ?
Or maybe a better idea ? ;)
Thanks for any help,
Marc
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
