> 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?
>
Hmm, to be honest - this code (I mean the old one) looks a little bit
strange
for me - perhaps it's too early this morning...
A new URL contained in this.context is build, this is converted to a file
object and it's then tested if it is a file. If not everything is as before
and if it is a file the parent directory is used instead.
Ok, so only if the context points to a file, the URL is changed.

I think your patch is slightly different: the URL is always changed to the
parent directory even if it is not a file, right? (I don't see what the
variable i means).
I assume - but haven't had time to look at it - that your approach might
fail with subsitemaps. You can define the src attribute for the subsitmap
by either giving the full sitemap name like "sub/sitemap.xmap" or by only
giving the directory name "sub".

Carsten


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to