Christopher Schultz wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dave,

David Kerber wrote:
Christopher Schultz wrote:
You could store your preferences in a JNDI context.

If you use <env-entry> in your web.xml instead of using <context-param>
or something else, then they will be automatically loaded into the
directory on startup, so you get your default values.
Yes, that's how I'm doing it, but changing the values in the <env-entry>
requires bouncing tomcat for my webapp to see the changes, unless
there's something I'm missing there.

You are using <context-param>? Right: don't do that. Instead, use
No, I'm using <env-entry>, with this in server.xml:

<Environment name="fileImportInterval" type="java.lang.String" value="60"/>

This in web.xml:
   <resource-env-ref>
       <resource-env-ref-name>fileImportInterval</resource-env-ref-name>
       <resource-env-ref-type>java.lang.string</resource-env-ref-type>
   </resource-env-ref>

 and retrieving it with this method:

public static String getEnvironmentVariable( String envVarName, String 
varDefault) {
        String  parm;
        try     {
                InitialContext initCtx = new InitialContext();
                if      (initCtx == null) throw new Exception( "No Context for 
database setting" );
                        Context envCtx = (Context) initCtx.lookup( 
"java:comp/env" );
                parm = (String) envCtx.lookup( envVarName );
                } catch(Exception e) {
                        parm = varDefault;
                }
                return parm;
        }


<env-entry> and use JNDI to get your preferences. Don't cache them
anywhere... always get them from JNDI.
Is that what the above method does? Or is there another way? Remember, my ultimate goal here is to be able to change these settings without bouncing my webapp.

Dave



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to