Whether you use AppModule.java, app.properties, or web.xml, it's still
hard-coding. Only constants belong in there.
Environment-specific properties can be set as system properties before
starting the server,
eg. for JBoss on Unix: setenv JAVA_OPTS '-Dtapestry.production-
mode=false -Dtapestry.compress-whitespace=false'
eg. for Tomcat in Windows: set JAVA_OPTS=-Dtapestry.production-
mode=false -Dtapestry.compress-whitespace=false
Or you can pick them up in the app from a file in the classpath, eg.
in the JBoss server's conf/ directory or Tomcat's server/lib/ (is that
right for Tomcat?); with this solution: http://wiki.apache.org/tapestry/Tapestry5HowToReadSymbolsFromPropertiesFile
Geoff
On 29/01/2009, at 1:06 PM, bongosdude wrote:
How are about other values like production_mode, cookie age which have
different values in DEV, QA and Production environments?
Even put it in the web.xml is not good either? I cannot change
web.xml when
we release software to QA and production.
Thanks
-B
Harald Geritzer-2 wrote:
you can put them into your web.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//
EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>MyApp</display-name>
<context-param>
<param-name>tapestry.supported-locales</param-name>
<param-value>de</param-value>
</context-param>
..
</web-app>
bongosdude schrieb:
hardcoded value in AppModule.contributeApplicationDefaults method
is not
a
best practice.
class AppModule {
......
public static void contributeApplicationDefaults(
MappedConfiguration<String, String> configuration ) {
configuration.add( SymbolConstants.SUPPORTED_LOCALES,
"de,en" );
configuration.add( "tapestry.default-cookie-max-age",
"31536000"
);
configuration.add( SymbolConstants.PRODUCTION_MODE,
"false" );
}
}
I would like to put those values: PRODUCTION_MODE, cookie-max-age
and
SUPPORTED_LOCALES in a properties file (i.e. app.properties) and
then get
the values from that file. So in QA, dev, the value of
PRODUCTION_MODE
should be false, but in production the value should be true.
How can I inject appropriate value from app.properties file?
i.e @Inject Message message;
Thank for any suggestion
-B
-----
B Amigo:super:
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org
-----
B Amigo:super:
--
View this message in context:
http://www.nabble.com/How-Can-I-not-hardcode-value-in-contributeApplicationDefaults-method.-tp21716553p21719510.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org