cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vadim Gritsenko" <vadim.gritse...@verizon.net>
Subject Help with AbstractEnvironment.changeContext
Date Mon, 11 Feb 2002 04:53:27 GMT
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?

Vadim



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


Mime
View raw message