You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Neeme Praks <ne...@apache.org> on 2008/09/18 09:46:40 UTC
[T5] loading tapestry configuration from properties file?
Hi,
I know Tapestry5 really pushes the convention-over-configuration
approach, but lets face it - in every non-trivial application you
eventually need to configure stuff. If not directly tapestry-related
properties, then at least your application.
By default, Tapestry seems to suggest that everybody should start using
web.xml for all such configuration purposes. At least that's the
impression that I get when looking at
http://tapestry.apache.org/tapestry5/guide/conf.html.
However, I don't particularly like the overly-verbose web.xml style of
configuring plain-simple properties - I'd rather use (the much more
concise) properties file syntax for that.
Is it possible to tell to Tapestry: "please load all properties from
WEB-INF/myapp.properties"?
If not, can someone give some pointers on how to implement it?
(it would also be a welcome "out-of-the-box" addition to Tapestry5)
Rgds,
Neeme
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Tapestry "Code base"
Posted by su...@gmx.de.
I would like to suggest introducing something like that:
http://bakery.cakephp.org/categories/view/3
on the tapestry homepage - as an official "code pool".
Maybe this way, more code samples and re-usable code would become available to the community!
Thanks!
Toby
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
RE: [T5] loading tapestry configuration from properties file?
Posted by taffit <ta...@gmail.com>.
Just wanted to give a big "Thank you" Ulrich for your wiki entry. It was
extremely helpful for me and just the thing I needed.
Thanks again, David
--
View this message in context: http://tapestry.1045711.n5.nabble.com/T5-loading-tapestry-configuration-from-properties-file-tp2426845p5481846.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
RE: [T5] loading tapestry configuration from properties file?
Posted by Algirdas <al...@gmail.com>.
I had some problems with deploying my project and reading properties with
this example (developed on Jetty - OK!, but deployed on Tomcat, and reading
properties failed).
Solution was in Tapestry source code:
InputStream in =
Thread.currentThread().getContextClassLoader().getResourceAsStream(resourceName);
reads resource from classpath :)
--
View this message in context: http://n2.nabble.com/-T5--loading-tapestry-configuration-from-properties-file--tp1097577p2177581.html
Sent from the Tapestry Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: [T5] loading tapestry configuration from properties file?
Posted by Neeme Praks <ne...@apache.org>.
I also revisited my code now. :-P
Changes:
* if not logger is supplied, it wraps all errors as
IllegalArgumentException (fail-fast, as requested by Russell)
* supports loading properties from existing Propeties/Dictionary object
* extends MapSymbolProvider - so it delegates all case sensitivity
issues to that class instead of handling those itself. So it becomes a
mere adapter to convert from Properties to Map.
As I'm still lazy and you didn't like me overwriting your code, I will
just attach it here. If you want, you can overwrite it yourself in wiki,
Rgds,
Neeme
Ulrich Stärk wrote:
> Neeme Praks schrieb:
>
>> PS. Sorry about the curly braces style in the refactored class - my
>> eclipse autoformatted it to my coding style and I was too lazy to
>> change it back
>
> Please don't be too lazy next time... I revised it a bit because I
> personally don't like to have several initialization methods (you called
> them load) for something as simple as loading a properties file. Also
> all Exceptions are now re-thrown as runtime exceptions so that Tapestry
> will fail to start when the properties file can not be found or loaded.
>
> Cheers,
>
> Uli
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
Re: [T5] loading tapestry configuration from properties file?
Posted by Ulrich Stärk <ul...@spielviel.de>.
Neeme Praks schrieb:
> PS. Sorry about the curly braces style in the refactored class - my
> eclipse autoformatted it to my coding style and I was too lazy to change
> it back
Please don't be too lazy next time... I revised it a bit because I personally don't like to have
several initialization methods (you called them load) for something as simple as loading a
properties file. Also all Exceptions are now re-thrown as runtime exceptions so that Tapestry will
fail to start when the properties file can not be found or loaded.
Cheers,
Uli
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: [T5] loading tapestry configuration from properties file?
Posted by Ulrich Stärk <ul...@spielviel.de>.
Russell Brown schrieb:
>> What 'it'? You mean symbol names?
>
> Well the 'it' was the class, or moreover the approach but that does result in specifically the
> symbol names in this instance, so: Yes that it, or they.
>
My PropertiesFileSymbolProvider now makes use of a CaseInsensitiveMap and on instantiation stores
all keys and their values from the properties file in this map for later retrieval. So querying for
a symbol is now case insensitive.
Uli
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: [T5] loading tapestry configuration from properties file?
Posted by Ulrich Stärk <ul...@spielviel.de>.
Neeme Praks schrieb:
>
> Ulrich Stärk wrote:
>> Russell Brown schrieb:
>>>> What 'it'? You mean symbol names?
>>>
>>> Well the 'it' was the class, or moreover the approach but that does
>>> result in specifically the
>>> symbol names in this instance, so: Yes that it, or they.
>>
>> Indeed. I think I could just load everything into a Map, thereby
>> making it all lower case, and call toLowerCase() on valueForSymbol()'s
>> argument during lookup. I'll see if I can find time to do that this
>> evening.
>
> Looking at the built-in MapSymbolProvider, I do not see any special
> handling of case-sensitivity either. Is it a possible bug or is this
> handled elsewhere?
>
> http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/MapSymbolProvider.java?view=markup
>
When the value type of the Map is String, Tapestry automatically instantiates an object of type
CaseInsensitiveMap.
Uli
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: [T5] loading tapestry configuration from properties file?
Posted by Neeme Praks <ne...@apache.org>.
Ulrich Stärk wrote:
> Russell Brown schrieb:
>>> What 'it'? You mean symbol names?
>>
>> Well the 'it' was the class, or moreover the approach but that does
>> result in specifically the
>> symbol names in this instance, so: Yes that it, or they.
>
> Indeed. I think I could just load everything into a Map, thereby making
> it all lower case, and call toLowerCase() on valueForSymbol()'s argument
> during lookup. I'll see if I can find time to do that this evening.
Looking at the built-in MapSymbolProvider, I do not see any special
handling of case-sensitivity either. Is it a possible bug or is this
handled elsewhere?
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/MapSymbolProvider.java?view=markup
Rgds,
Neeme
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: [T5] loading tapestry configuration from properties file?
Posted by Ulrich Stärk <ul...@spielviel.de>.
Russell Brown schrieb:
>> What 'it'? You mean symbol names?
>
> Well the 'it' was the class, or moreover the approach but that does result in specifically the
> symbol names in this instance, so: Yes that it, or they.
Indeed. I think I could just load everything into a Map, thereby making it all lower case, and call
toLowerCase() on valueForSymbol()'s argument during lookup. I'll see if I can find time to do that
this evening.
>
>> Because That's the Way I Like It! :-) Seriously, I struggled with myself about this and decided
>> that in my case it's better to have the application start up and fail later IF a missing symbol
>> is requested.
>
> Fair enough then. I did it differently (since I'd like to know at start up if my app is
> miss-configured), I guess the solution needs to fit the requirements.
But your approach is valid, too, and it seems that Howard is following the same path for Tapestry. I
changed that in the wiki article so that all exceptions now get thrown as runtime exceptions.
Uli
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
RE: [T5] loading tapestry configuration from properties file?
Posted by Russell Brown <Ru...@ioko.com>.
> What 'it'? You mean symbol names?
Well the 'it' was the class, or moreover the approach but that does result in specifically the symbol names in this instance, so: Yes that it, or they.
> Because That's the Way I Like It! :-)
> Seriously, I struggled with myself about this and decided that in my case it's better to have the
>application start up and fail later IF a missing symbol is requested.
Fair enough then. I did it differently (since I'd like to know at start up if my app is miss-configured), I guess the solution needs to fit the requirements.
Cheers
Russell
-----Original Message-----
From: Ulrich Stärk [mailto:uli@spielviel.de]
Sent: 18 September 2008 16:15
To: Tapestry users
Subject: Re: [T5] loading tapestry configuration from properties file?
Russell Brown schrieb:
> I still think you need to T5-alize it and make it case insensitive.
What 'it'? You mean symbol names?
>
> And why oh why oh why bury your exceptions and just log them? Why not let them bubble up so that
> they are thrown? Otherwise you will just get a symbol exception which is hard to figure out later
> on?
Because That's the Way I Like It! :-)
Seriously, I struggled with myself about this and decided that in my case it's better to have the
application start up and fail later IF a missing symbol is requested.
Uli
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: [T5] loading tapestry configuration from properties file?
Posted by Ulrich Stärk <ul...@spielviel.de>.
Russell Brown schrieb:
> I still think you need to T5-alize it and make it case insensitive.
What 'it'? You mean symbol names?
>
> And why oh why oh why bury your exceptions and just log them? Why not let them bubble up so that
> they are thrown? Otherwise you will just get a symbol exception which is hard to figure out later
> on?
Because That's the Way I Like It! :-)
Seriously, I struggled with myself about this and decided that in my case it's better to have the
application start up and fail later IF a missing symbol is requested.
Uli
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
RE: Re: [T5] loading tapestry configuration from properties file?
Posted by Russell Brown <Ru...@ioko.com>.
I still think you need to T5-alize it and make it case insensitive.
And why oh why oh why bury your exceptions and just log them? Why not let them bubble up so that they are thrown? Otherwise you will just get a symbol exception which is hard to figure out later on?
Cheers
Russell
-----Original Message-----
From: news [mailto:news@ger.gmane.org] On Behalf Of Neeme Praks
Sent: 18 September 2008 14:08
To: users@tapestry.apache.org
Subject: Re: [T5] loading tapestry configuration from properties file?
Nice, thanks for that one.
I would suggest to add that "PropertiesFileSymbolProvider" class also to
main Tapestry5 distribution. And I took the liberty to refactor the
symbol provider implementation in wiki to be more generic: it now
accepts also URL and InputStream as possible places to load the properties.
Rgds,
Neeme
PS. Sorry about the curly braces style in the refactored class - my
eclipse autoformatted it to my coding style and I was too lazy to change
it back
Ulrich Stärk wrote:
> Here you go:
> http://wiki.apache.org/tapestry/Tapestry5HowToReadSymbolsFromPropertiesFile
>
> Cheers,
>
> Uli
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: [T5] loading tapestry configuration from properties file?
Posted by Neeme Praks <ne...@apache.org>.
Nice, thanks for that one.
I would suggest to add that "PropertiesFileSymbolProvider" class also to
main Tapestry5 distribution. And I took the liberty to refactor the
symbol provider implementation in wiki to be more generic: it now
accepts also URL and InputStream as possible places to load the properties.
Rgds,
Neeme
PS. Sorry about the curly braces style in the refactored class - my
eclipse autoformatted it to my coding style and I was too lazy to change
it back
Ulrich Stärk wrote:
> Here you go:
> http://wiki.apache.org/tapestry/Tapestry5HowToReadSymbolsFromPropertiesFile
>
> Cheers,
>
> Uli
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
RE: [T5] loading tapestry configuration from properties file?
Posted by Russell Brown <Ru...@ioko.com>.
+1 for having it I the framework since virtually *everyone* seems to end up writing one or wanting one.
Cheers
Russell
-----Original Message-----
From: Borut Bolčina [mailto:borut.bolcina@gmail.com]
Sent: 03 October 2008 11:59
To: Tapestry users
Subject: Re: [T5] loading tapestry configuration from properties file?
Hi,
will this PropertiesFileSymbolProvider make into the framework?
Cheers,
Borut
2008/9/18 Ulrich Stärk <ul...@spielviel.de>
> Here you go:
> http://wiki.apache.org/tapestry/Tapestry5HowToReadSymbolsFromPropertiesFile
>
> Cheers,
>
> Uli
>
> Peter Stavrinides schrieb:
>
> Thats great thanks for sharing!
>>
>> ----- Original Message -----
>> From: "Ulrich Stärk" <ul...@spielviel.de>
>> To: "Tapestry users" <us...@tapestry.apache.org>
>> Sent: Thursday, 18 September, 2008 11:44:30 AM GMT +02:00 Athens, Beirut,
>> Bucharest, Istanbul
>> Subject: Re: [T5] loading tapestry configuration from properties file?
>>
>> I wrote a SymbolProvider that reads a properties file either from
>> classpath or a filesystem location. I'm going to write a wiki howto about it
>> today.
>>
>> Uli
>>
>> Neeme Praks schrieb:
>>
>>> Hi,
>>>
>>> I know Tapestry5 really pushes the convention-over-configuration
>>> approach, but lets face it - in every non-trivial application you
>>> eventually need to configure stuff. If not directly tapestry-related
>>> properties, then at least your application.
>>>
>>> By default, Tapestry seems to suggest that everybody should start using
>>> web.xml for all such configuration purposes. At least that's the
>>> impression that I get when looking at
>>> http://tapestry.apache.org/tapestry5/guide/conf.html.
>>>
>>> However, I don't particularly like the overly-verbose web.xml style of
>>> configuring plain-simple properties - I'd rather use (the much more
>>> concise) properties file syntax for that.
>>>
>>> Is it possible to tell to Tapestry: "please load all properties from
>>> WEB-INF/myapp.properties"?
>>>
>>> If not, can someone give some pointers on how to implement it?
>>> (it would also be a welcome "out-of-the-box" addition to Tapestry5)
>>>
>>> Rgds,
>>> Neeme
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
Re: [T5] loading tapestry configuration from properties file?
Posted by Borut Bolčina <bo...@gmail.com>.
Hi,
will this PropertiesFileSymbolProvider make into the framework?
Cheers,
Borut
2008/9/18 Ulrich Stärk <ul...@spielviel.de>
> Here you go:
> http://wiki.apache.org/tapestry/Tapestry5HowToReadSymbolsFromPropertiesFile
>
> Cheers,
>
> Uli
>
> Peter Stavrinides schrieb:
>
> Thats great thanks for sharing!
>>
>> ----- Original Message -----
>> From: "Ulrich Stärk" <ul...@spielviel.de>
>> To: "Tapestry users" <us...@tapestry.apache.org>
>> Sent: Thursday, 18 September, 2008 11:44:30 AM GMT +02:00 Athens, Beirut,
>> Bucharest, Istanbul
>> Subject: Re: [T5] loading tapestry configuration from properties file?
>>
>> I wrote a SymbolProvider that reads a properties file either from
>> classpath or a filesystem location. I'm going to write a wiki howto about it
>> today.
>>
>> Uli
>>
>> Neeme Praks schrieb:
>>
>>> Hi,
>>>
>>> I know Tapestry5 really pushes the convention-over-configuration
>>> approach, but lets face it - in every non-trivial application you
>>> eventually need to configure stuff. If not directly tapestry-related
>>> properties, then at least your application.
>>>
>>> By default, Tapestry seems to suggest that everybody should start using
>>> web.xml for all such configuration purposes. At least that's the
>>> impression that I get when looking at
>>> http://tapestry.apache.org/tapestry5/guide/conf.html.
>>>
>>> However, I don't particularly like the overly-verbose web.xml style of
>>> configuring plain-simple properties - I'd rather use (the much more
>>> concise) properties file syntax for that.
>>>
>>> Is it possible to tell to Tapestry: "please load all properties from
>>> WEB-INF/myapp.properties"?
>>>
>>> If not, can someone give some pointers on how to implement it?
>>> (it would also be a welcome "out-of-the-box" addition to Tapestry5)
>>>
>>> Rgds,
>>> Neeme
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
Re: [T5] loading tapestry configuration from properties file?
Posted by Hugues Narjoux <hu...@gmail.com>.
Great Wiki ! Thx for sharing !
Hugues
On Thu, Sep 18, 2008 at 1:22 PM, Ulrich Stärk <ul...@spielviel.de> wrote:
> Here you go:
> http://wiki.apache.org/tapestry/Tapestry5HowToReadSymbolsFromPropertiesFile
>
> Cheers,
>
> Uli
>
> Peter Stavrinides schrieb:
>
> Thats great thanks for sharing!
>>
>> ----- Original Message -----
>> From: "Ulrich Stärk" <ul...@spielviel.de>
>> To: "Tapestry users" <us...@tapestry.apache.org>
>> Sent: Thursday, 18 September, 2008 11:44:30 AM GMT +02:00 Athens, Beirut,
>> Bucharest, Istanbul
>> Subject: Re: [T5] loading tapestry configuration from properties file?
>>
>> I wrote a SymbolProvider that reads a properties file either from
>> classpath or a filesystem location. I'm going to write a wiki howto about it
>> today.
>>
>> Uli
>>
>> Neeme Praks schrieb:
>>
>>> Hi,
>>>
>>> I know Tapestry5 really pushes the convention-over-configuration
>>> approach, but lets face it - in every non-trivial application you
>>> eventually need to configure stuff. If not directly tapestry-related
>>> properties, then at least your application.
>>>
>>> By default, Tapestry seems to suggest that everybody should start using
>>> web.xml for all such configuration purposes. At least that's the
>>> impression that I get when looking at
>>> http://tapestry.apache.org/tapestry5/guide/conf.html.
>>>
>>> However, I don't particularly like the overly-verbose web.xml style of
>>> configuring plain-simple properties - I'd rather use (the much more
>>> concise) properties file syntax for that.
>>>
>>> Is it possible to tell to Tapestry: "please load all properties from
>>> WEB-INF/myapp.properties"?
>>>
>>> If not, can someone give some pointers on how to implement it?
>>> (it would also be a welcome "out-of-the-box" addition to Tapestry5)
>>>
>>> Rgds,
>>> Neeme
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
Re: [T5] loading tapestry configuration from properties file?
Posted by Ulrich Stärk <ul...@spielviel.de>.
Here you go: http://wiki.apache.org/tapestry/Tapestry5HowToReadSymbolsFromPropertiesFile
Cheers,
Uli
Peter Stavrinides schrieb:
> Thats great thanks for sharing!
>
> ----- Original Message -----
> From: "Ulrich Stärk" <ul...@spielviel.de>
> To: "Tapestry users" <us...@tapestry.apache.org>
> Sent: Thursday, 18 September, 2008 11:44:30 AM GMT +02:00 Athens, Beirut, Bucharest, Istanbul
> Subject: Re: [T5] loading tapestry configuration from properties file?
>
> I wrote a SymbolProvider that reads a properties file either from classpath or a filesystem
> location. I'm going to write a wiki howto about it today.
>
> Uli
>
> Neeme Praks schrieb:
>> Hi,
>>
>> I know Tapestry5 really pushes the convention-over-configuration
>> approach, but lets face it - in every non-trivial application you
>> eventually need to configure stuff. If not directly tapestry-related
>> properties, then at least your application.
>>
>> By default, Tapestry seems to suggest that everybody should start using
>> web.xml for all such configuration purposes. At least that's the
>> impression that I get when looking at
>> http://tapestry.apache.org/tapestry5/guide/conf.html.
>>
>> However, I don't particularly like the overly-verbose web.xml style of
>> configuring plain-simple properties - I'd rather use (the much more
>> concise) properties file syntax for that.
>>
>> Is it possible to tell to Tapestry: "please load all properties from
>> WEB-INF/myapp.properties"?
>>
>> If not, can someone give some pointers on how to implement it?
>> (it would also be a welcome "out-of-the-box" addition to Tapestry5)
>>
>> Rgds,
>> Neeme
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: [T5] loading tapestry configuration from properties file?
Posted by Peter Stavrinides <P....@albourne.com>.
Thats great thanks for sharing!
----- Original Message -----
From: "Ulrich Stärk" <ul...@spielviel.de>
To: "Tapestry users" <us...@tapestry.apache.org>
Sent: Thursday, 18 September, 2008 11:44:30 AM GMT +02:00 Athens, Beirut, Bucharest, Istanbul
Subject: Re: [T5] loading tapestry configuration from properties file?
I wrote a SymbolProvider that reads a properties file either from classpath or a filesystem
location. I'm going to write a wiki howto about it today.
Uli
Neeme Praks schrieb:
> Hi,
>
> I know Tapestry5 really pushes the convention-over-configuration
> approach, but lets face it - in every non-trivial application you
> eventually need to configure stuff. If not directly tapestry-related
> properties, then at least your application.
>
> By default, Tapestry seems to suggest that everybody should start using
> web.xml for all such configuration purposes. At least that's the
> impression that I get when looking at
> http://tapestry.apache.org/tapestry5/guide/conf.html.
>
> However, I don't particularly like the overly-verbose web.xml style of
> configuring plain-simple properties - I'd rather use (the much more
> concise) properties file syntax for that.
>
> Is it possible to tell to Tapestry: "please load all properties from
> WEB-INF/myapp.properties"?
>
> If not, can someone give some pointers on how to implement it?
> (it would also be a welcome "out-of-the-box" addition to Tapestry5)
>
> Rgds,
> Neeme
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: [T5] loading tapestry configuration from properties file?
Posted by Ulrich Stärk <ul...@spielviel.de>.
I wrote a SymbolProvider that reads a properties file either from classpath or a filesystem
location. I'm going to write a wiki howto about it today.
Uli
Neeme Praks schrieb:
> Hi,
>
> I know Tapestry5 really pushes the convention-over-configuration
> approach, but lets face it - in every non-trivial application you
> eventually need to configure stuff. If not directly tapestry-related
> properties, then at least your application.
>
> By default, Tapestry seems to suggest that everybody should start using
> web.xml for all such configuration purposes. At least that's the
> impression that I get when looking at
> http://tapestry.apache.org/tapestry5/guide/conf.html.
>
> However, I don't particularly like the overly-verbose web.xml style of
> configuring plain-simple properties - I'd rather use (the much more
> concise) properties file syntax for that.
>
> Is it possible to tell to Tapestry: "please load all properties from
> WEB-INF/myapp.properties"?
>
> If not, can someone give some pointers on how to implement it?
> (it would also be a welcome "out-of-the-box" addition to Tapestry5)
>
> Rgds,
> Neeme
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
RE: [T5] loading tapestry configuration from properties file?
Posted by Russell Brown <Ru...@ioko.com>.
You can write a Property File based symbol provider implementation (or that is what I did). Mine just takes an array of strings (which are properties files on the class path) and loads them into a map. Then your imp los SymbolProvider.valueForSymbol(String) is just yourSymbolMap.get(String). To keep it all Tapestry 5esque I call .toLowerCase() on all my keys before I put them in the map and toLowerCase() on the symbol I am looking up.
Cheers
Russell
-----Original Message-----
From: news [mailto:news@ger.gmane.org] On Behalf Of Neeme Praks
Sent: 18 September 2008 08:47
To: users@tapestry.apache.org
Subject: [T5] loading tapestry configuration from properties file?
Hi,
I know Tapestry5 really pushes the convention-over-configuration
approach, but lets face it - in every non-trivial application you
eventually need to configure stuff. If not directly tapestry-related
properties, then at least your application.
By default, Tapestry seems to suggest that everybody should start using
web.xml for all such configuration purposes. At least that's the
impression that I get when looking at
http://tapestry.apache.org/tapestry5/guide/conf.html.
However, I don't particularly like the overly-verbose web.xml style of
configuring plain-simple properties - I'd rather use (the much more
concise) properties file syntax for that.
Is it possible to tell to Tapestry: "please load all properties from
WEB-INF/myapp.properties"?
If not, can someone give some pointers on how to implement it?
(it would also be a welcome "out-of-the-box" addition to Tapestry5)
Rgds,
Neeme
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: [T5] loading tapestry configuration from properties file?
Posted by Massimo Lusetti <ml...@gmail.com>.
On Thu, Sep 18, 2008 at 9:46 AM, Neeme Praks <ne...@apache.org> wrote:
> Is it possible to tell to Tapestry: "please load all properties from
> WEB-INF/myapp.properties"?
>
> If not, can someone give some pointers on how to implement it?
> (it would also be a welcome "out-of-the-box" addition to Tapestry5)
Do it in the contributeApplicationDefaults with less then 10 lines.
--
Massimo
http://meridio.blogspot.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org