struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gemes Tibor <...@i-trade.hu>
Subject Re: AW: loading configuration on startup
Date Wed, 22 Jan 2003 12:13:07 GMT
2003. január 22. 12:59 dátummal Softwareentwicklung Hauschel ezt írtad:
> But my log4j.properties are a log4j.xml file.
> That doesn't work in classpath ;-(
> In addition there are mor configurations i need for the whole applikation.

I can't see why can you not pick up the init-params in your serlvet's init() 
method. It's so easy. 
For each servlet I wrote I provide the config parameter which is an xml file. 
This xml is parsed with Digester. 
This is how I do it, and do not be surprised if you see some coincidence with 
the ActionServlet's init() method...

    public void init() throws ServletException {
        String value;

        try {
            LOG.debug("start init");
            // Initialize the context-relative path to our configuration 
resources
            value = getServletConfig().getInitParameter("config");
            if (value != null)
                config = value;
            // Acquire an input stream to our configuration resource
            InputStream input = 
getServletContext().getResourceAsStream(config);
            if (input == null)
                throw new UnavailableException
                ("config file '" + config + "' is missing");

            Digester digester = null;
            digester = initDigester();
	...


Hth,

Tib

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message