struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Nenning <Christoph.Nenn...@lex-com.net>
Subject issue with devMode changes in 2.3.16
Date Mon, 30 Dec 2013 13:19:56 GMT
Dear List,


in some applications we use a custom ConfigurationProvider to use our own 
stage specific config to enable devMode automatically for development 
stages.

In struts 2.3.16 devMode was changed to allow disabling of e.g. config 
reloading or resources reloading even when devMode is enabled. That is 
done in DefaultBeanSelectionProvider.switchDevMode()

That method looks like this:

    private void switchDevMode(LocatableProperties props) {
        if ("true".equalsIgnoreCase(props.getProperty(StrutsConstants.
STRUTS_DEVMODE))) {
            if (props.getProperty(StrutsConstants.STRUTS_I18N_RELOAD) == 
null) {
                props.setProperty(StrutsConstants.STRUTS_I18N_RELOAD, 
"true");
            }
            if (props.getProperty(StrutsConstants.
STRUTS_CONFIGURATION_XML_RELOAD) == null) {
                props.setProperty(StrutsConstants.
STRUTS_CONFIGURATION_XML_RELOAD, "true");
            }
            if (props.getProperty(StrutsConstants.
STRUTS_FREEMARKER_TEMPLATES_CACHE) == null) {
                props.setProperty(StrutsConstants.
STRUTS_FREEMARKER_TEMPLATES_CACHE, "false");
            }
            if (props.getProperty(StrutsConstants.
STRUTS_FREEMARKER_TEMPLATES_CACHE_UPDATE_DELAY) == null) {
                props.setProperty(StrutsConstants.
STRUTS_FREEMARKER_TEMPLATES_CACHE_UPDATE_DELAY, "0");
            }
            // Convert struts properties into ones that xwork expects
            props.setProperty(XWorkConstants.DEV_MODE, "true");


For our application the following happens:
- in Dispatcher.init() ConfigurationProviders are instantiated
- init_DefaultProperties() is called before 
init_CustomConfigurationProviders()
- When our CustomConfigurationProvider is called, it triggers 
switchDevMode()
- at that time DefaultPropertiesProvider has already run and reloading 
properties are set to false
- hence the above if statements in switchDevMode() all evaluate to false 
and reloading is not enabled.


That means we have to explicitly enable config and resources reloading in 
our own ConfigProvider.


Is that behavior intended?
Would you mind to add a note about that to the wiki?
What do you think about another init-param in web.xml to optionally move 
init_CustomConfigurationProviders() at the top of init calls?


regards,
Christoph

This Email was scanned by Sophos Anti Virus

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message