cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From giacomo <giac...@apache.org>
Subject Re: Help with AbstractEnvironment.changeContext
Date Mon, 11 Feb 2002 10:00:48 GMT
On Sun, 10 Feb 2002, Vadim Gritsenko wrote:

> All, Giacomo, Carsten,
>
> Looking into the AbstractEnvironment.changeContext() I do not understand
> one part:
>
>             File f = new File(this.context.getFile());
>             if (f.isFile()) {
>                 this.context = f.getParentFile().toURL();
>             } else {
>                 this.context = f.toURL();
>             }
>
> Is it essentially converting file to a directory entry where the file
> belongs? Can it be then rewritten to something like:
>
>             String s = this.context.toString();
>             if (i != -1 && i + 1 < s.length()) {
>                 s = s.substring(0, s.lastIndexOf('/') + 1);
>             }
>             this.context = new URL(s);
>
> With this change it:
> 1. Preserves original protocol. Before, "jndi:" URLs were converted to
> "file:" URLs.
> 2. Works under tomcat as before.
> 3. Works under Borland App Server deployed as unpacked WAR (Thanks to
> Nick Airey who tested this).
>
> Does anybody see any issues with changing this bit of code?

I'm not sure anymore (long time ago since I've looked at that piece of
code). I think this is because of mounting sub-sitemaps which can denote
a directory (where a sitemap.xmap file is searched in) and the concrete
sitemap file to use in that directory, which is used a the new context.

Giacomo


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message