avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <blorit...@apache.org>
Subject Re: [Patch] #13 resubmitted
Date Mon, 02 Jun 2003 13:19:36 GMT
Anton Tagunov wrote:
> Hello Berin!
> 
> AT> +    public void setContextDirectory( final URL url )
> 
> Further investigation has shown that this patch _is_ needed.
> In fact, in a servlet I do
> 
> URL urlRoot = servletContext.getResource( "/WEB-INF/avalon" );
> String stringRoot = urlRoot.toExternalFort();
> FortressConfig.setContextDirectory( stringRoot );

You can bind a File object directly like this:

FortressConfig.setContextDirectory(
     servletContext.getRealPath( "/WEB-INF/avalon" ) );

> and I get something like (writing by memory)
>     file:/C:/file/D:\goj\t331ah\webapps\tst\WEB-INF\avalon
> on Windows.
> 
> When however I first create a DefaultContext() and bind in
> urlRoot as "context-root" to it and create FortressContext
> on it then all is ok
>     file:D:\goj\t331ah\webapps\tst\WEB-INF\avalon
> 
> So, I'm resending the patch.


The problem here is a bug in the toExternalForm() method.
This is most likely from your J2EE servlet container vendor.
Notice that there is no colon after the second file?  There
is also no protocol named "file/D" so that is why it fails.
The thing is I believe Fortress expects a File root, although
it is primarily for the SourceResolver--which can handle both
URL and File.

We need to make it simple to work with--and either work with
Files or URLs.  The thing is that some vendors like IBM
WebSphere relocate everything and use a "classloader:" protocol.
If you use the context root as a relative location for the
log file (as is the default case), then you need a File, and
not a URL.


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


Mime
View raw message