The way I do mine is via web.xml:

<!-- Switches dev mode via site.devMode property -->
    <listener>

<listener-class>ui.struts2.util.config.EnvironmentListener</listener-class>
    </listener>

public class EnvironmentListener implements ServletContextListener {

    private static Log log = LogFactory.getLog(EnvironmentListener.class);

    /**
     * @see
javax.servlet.ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent)
     */
    public void contextInitialized(ServletContextEvent event) {

        try {

            Dispatcher
                    .addDispatcherListener(new
EnvironmentDispatcherListener());

        } catch (Exception e) {
            log.error("Error adding EnvironmentDispatcherListener", e);

        }

    }

    /**
     * @see
javax.servlet.ServletContextListener#contextDestroyed(javax.servlet.ServletContextEvent)
     */
    public void contextDestroyed(ServletContextEvent arg0) {
        // do nothing
    }
}

#######

public class EnvironmentDispatcherListener implements DispatcherListener {

    private static Log log = LogFactory
            .getLog(EnvironmentDispatcherListener.class);

    /**
     * @see
org.apache.struts2.dispatcher.DispatcherListener#dispatcherInitialized
     *      (Dispatcher)
     */
    public void dispatcherInitialized(Dispatcher dispatcher) {

        // Set system dev mode
        Boolean debug = RuntimeConfig.getBooleanProperty("site.devMode");

        // Note this only does the messages not
        // struts.configuration.xml.reload=false or struts.i18n.reload=false
        if (debug) {
            dispatcher.setDevMode("true");
            log.info("Devel environment: devMode is active");
        } else {
            dispatcher.setDevMode("false");
            log.info("Devel environment: devMode is in-active");
        }

    }

    /**
     * @see
org.apache.struts2.dispatcher.DispatcherListener#dispatcherDestroyed(Dispatcher)
     */
    public void dispatcherDestroyed(Dispatcher dispatcher) {
        // do nothing
    }

}

I could not find a way to do struts.configuration.xml.reload or
struts.i18n.reload :

struts.properties:

# dev mode options.  See site.devMode mode via EnvironmentListener in
web.xml
#struts.devMode=false
struts.configuration.xml.reload=true
struts.i18n.reload=true

Cheers Greg


On 16 February 2014 12:37, Lukasz Lenart <lukaszlen...@apache.org> wrote:

> Hi,
>
> Do you know how does it work? I need some usage example.
>
>
> Regards
> --
> Ɓukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@struts.apache.org
> For additional commands, e-mail: dev-h...@struts.apache.org
>
>

Reply via email to