You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by da...@daune-consult.com on 2007/05/02 15:29:32 UTC

[Configuration] J2EE file mapping

Hi,

I would like to use DefaultConfigurationBuilder in a servlet, but it  
cannot properly handle a property file, as <properties/> only has  
'fileName' tag.

There is no way to pass it a URL instead.

Any idea about this?

Cheers,

J-F


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [Configuration] J2EE file mapping

Posted by da...@daune-consult.com.
Quoting Oliver Heger <ol...@oliver-heger.de>:

> daune.jf@daune-consult.com wrote:
>> Hi,
>>
>> I would like to use DefaultConfigurationBuilder in a servlet, but   
>> it cannot properly handle a property file, as <properties/> only   
>> has 'fileName' tag.
>>
>> There is no way to pass it a URL instead.
>>
>> Any idea about this?
>>
>> Cheers,
>>
>> J-F
>>
>>
> The fileName attribute should also accept full path names and URLs. The
> internal mechanism for locating configuration files checks for all
> these possibilities.
>
> BTW: the attributes are directly mapped to properties (i.e. setXXX
> methods) of the configuration classes to be created. So you could also
> use other properties available in PropertiesConfiguration or its base
> classes.
>
> Oliver
>

This is not what I observe. And this is not what I read from code.

By debugging, I see that ConfigurationUtils.locate(String, String) is  
called with the builder config file as base resource (from  
AbstractFileConfiguration).

So, if the builder config file is 'config.xml', and that file contains  
<properties fileName="jndi:/bla bla bla"/>, ConfigurationUtils  
attempts to concatenate 'config.xml' and 'jndi:/bla bla bla', ending  
up with malformed URL.

The attribute 'fileName' is really for files.

The attribute 'url' does not work. It must be 'URL' in uppercase. Not  
easy to find out, especially with UltraEdit automatically rlling back  
to lowercase.

J-F




---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [Configuration] J2EE file mapping

Posted by Oliver Heger <ol...@oliver-heger.de>.
daune.jf@daune-consult.com wrote:
> Hi,
> 
> I would like to use DefaultConfigurationBuilder in a servlet, but it 
> cannot properly handle a property file, as <properties/> only has 
> 'fileName' tag.
> 
> There is no way to pass it a URL instead.
> 
> Any idea about this?
> 
> Cheers,
> 
> J-F
> 
> 
The fileName attribute should also accept full path names and URLs. The 
internal mechanism for locating configuration files checks for all these 
possibilities.

BTW: the attributes are directly mapped to properties (i.e. setXXX 
methods) of the configuration classes to be created. So you could also 
use other properties available in PropertiesConfiguration or its base 
classes.

Oliver

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org