You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Matthias <th...@gmail.com> on 2014/01/07 18:54:52 UTC

Application properties

Hi,

I'm looking for the best way to set global application properties like 
the path to my data directory or the url of my solr server. Currently I 
set them within the contributeApplicationDefaults() method of my modules 
(I have a production and development module). But I don't want to set 
them in Java, because they can change and I have to recompile and 
redeploy my project.

After a google search I found the WEB-INF/app.properties, but the file 
is only for the messages catalog (correct me if im wrong).

Any suggestions?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Application properties

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Tue, 07 Jan 2014 15:54:52 -0200, Matthias <th...@gmail.com>  
wrote:

> Hi,

Hi!

> I'm looking for the best way to set global application properties like  
> the path to my data directory or the url of my solr server. Currently I  
> set them within the contributeApplicationDefaults() method of my modules  
> (I have a production and development module). But I don't want to set  
> them in Java, because they can change and I have to recompile and  
> redeploy my project.
>
> After a google search I found the WEB-INF/app.properties, but the file  
> is only for the messages catalog (correct me if im wrong).

Most projects I've worked on put this stuff into property files which are  
read by AppModule.contributeApplicationDefaults() using the Property class.

-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Application properties

Posted by Rural Hunter <ru...@gmail.com>.
You can also put it in web.xml and access it in your pages/services via 
injected symbol.

于 2014/1/8 3:15, Matthias 写道:
> I thought that there is a tapestry way of doing this. But if not, I 
> try to use the database. I actually never thought of that, so thanks 
> for the tip.
>
> On 07.01.2014 19:24, Bob Harner wrote:
>> You have all the options available to you that any other Java app 
>> provides:
>>
>> 1) put name/value pairs in a CONFIGURATION table in the database.
> never thought of that, thanks for the tip.
>
>> 2) put name/value pairs in a property file in a location of your
>> choosing. Java has built-in features to read property files
>>
>> 3) set system properties or environment variables at the OS level or
>> in your app's startup script, and read them using standard Java APIs
>>
>> #1 is my favorite (lots of flexibility; you can even provide a web
>> interface to edit some of them if desired).
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Application properties

Posted by Matthias <th...@gmail.com>.
I thought that there is a tapestry way of doing this. But if not, I try 
to use the database. I actually never thought of that, so thanks for the 
tip.

On 07.01.2014 19:24, Bob Harner wrote:
> You have all the options available to you that any other Java app provides:
>
> 1) put name/value pairs in a CONFIGURATION table in the database.
never thought of that, thanks for the tip.

> 2) put name/value pairs in a property file in a location of your
> choosing. Java has built-in features to read property files
>
> 3) set system properties or environment variables at the OS level or
> in your app's startup script, and read them using standard Java APIs
>
> #1 is my favorite (lots of flexibility; you can even provide a web
> interface to edit some of them if desired).
>
> On Tue, Jan 7, 2014 at 12:54 PM, Matthias <th...@gmail.com> wrote:
>> Hi,
>>
>> I'm looking for the best way to set global application properties like the
>> path to my data directory or the url of my solr server. Currently I set them
>> within the contributeApplicationDefaults() method of my modules (I have a
>> production and development module). But I don't want to set them in Java,
>> because they can change and I have to recompile and redeploy my project.
>>
>> After a google search I found the WEB-INF/app.properties, but the file is
>> only for the messages catalog (correct me if im wrong).
>>
>> Any suggestions?
>>
>> ---------------------------------------------------------------------
>> 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: Application properties

Posted by Bob Harner <bo...@gmail.com>.
You have all the options available to you that any other Java app provides:

1) put name/value pairs in a CONFIGURATION table in the database.

2) put name/value pairs in a property file in a location of your
choosing. Java has built-in features to read property files

3) set system properties or environment variables at the OS level or
in your app's startup script, and read them using standard Java APIs

#1 is my favorite (lots of flexibility; you can even provide a web
interface to edit some of them if desired).

On Tue, Jan 7, 2014 at 12:54 PM, Matthias <th...@gmail.com> wrote:
> Hi,
>
> I'm looking for the best way to set global application properties like the
> path to my data directory or the url of my solr server. Currently I set them
> within the contributeApplicationDefaults() method of my modules (I have a
> production and development module). But I don't want to set them in Java,
> because they can change and I have to recompile and redeploy my project.
>
> After a google search I found the WEB-INF/app.properties, but the file is
> only for the messages catalog (correct me if im wrong).
>
> Any suggestions?
>
> ---------------------------------------------------------------------
> 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