users@glassfish.java.net

Setting web.xml env-entries at deployment time

From: Paul <paul_at_nosphere.org>
Date: Tue, 25 Nov 2008 20:05:27 +0100

Hello glassfish users,

Let's say I have a servlet that gets some env-entries injected like this :

[code]

    @Resource(name = "acme/configuration/file")
    public void setConfigurationFilePath(String configurationFilePath) {
        this.configurationFilePath = configurationFilePath;
    }


    @Resource(name = "acme/configuration/check-interval")
    public void setPoolerInterval(Integer poolerInterval) {
        this.poolerInterval = poolerInterval;
    }

[/code]


My web.xml file contains sensible default values (I don't know if that's the
right way, my question will follow) :

[code]

    <env-entry>
        <env-entry-name>acme/configuration/file</env-entry-name>
        <env-entry-type>java.lang.String</env-entry-type>
        <env-entry-value>/opt/acme/etc/acme.xml</env-entry-value>
    </env-entry>
    <env-entry>
        <env-entry-name>acme/configuration/check-interval</env-entry-name>
        <env-entry-type>java.lang.Integer</env-entry-type>
        <env-entry-value>10</env-entry-value>
    </env-entry>

[/code]


I would like to be able to set/override theses "variables" at deployment time
without repackaging.

Is there a way with some asadmin command ?

Are the glassfish Deployment Plans (asadmin deploy --deploymentplan ...) the
way to go ? How ?

Thanks in advance.

I'm using a promoted build of v2.1.

Paul