You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-user@james.apache.org by Carl Gottlieb <cg...@mobilesys.com> on 2001/12/12 18:48:26 UTC

MailetConfig init parameters

Hi,

How can I define initialization parameters for a Mailet?

I would like to implement something like the following...

    public void init(MailetConfig config) throws MailetException {
        	String paramValue = config.getInitParameter("paramName");

	configSomethingElse(paramValue);
    }

but I am puzzled as to where and how to specify the parameter.

Thanks,
Carl

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: MailetConfig init parameters

Posted by Lucas Gonze <lu...@gonze.com>.
Carl,

You do it in the same spot in the config file where your class gets loaded.  EG:

                <!-- find this in the conf file -->
                <processor name="root">

				    <!-- Load your Mailet.  Note that "packagename.MyMailetClass"
				         has to be loadable within the classpath. -->
				    <mailet match="All" class="packagename.MyMailetClass">

				      <!-- you can pick settings up in your Mailet
				           via getInitParameter("myParam") -->
					<myParam>value of param</myParam>

				    </mailet>

                <!-- ... -->
                <processor name="root">

- Lucas



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


> -----Original Message-----
> From: Carl Gottlieb [mailto:cgottlie@mobilesys.com]
> Sent: Wednesday, December 12, 2001 12:48 PM
> To: 'james-user@jakarta.apache.org'
> Subject: MailetConfig init parameters
>
>
> Hi,
>
> How can I define initialization parameters for a Mailet?
>
> I would like to implement something like the following...
>
>     public void init(MailetConfig config) throws MailetException {
>         	String paramValue = config.getInitParameter("paramName");
>
> 	configSomethingElse(paramValue);
>     }
>
> but I am puzzled as to where and how to specify the parameter.
>
> Thanks,
> Carl
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: MailetConfig init parameters

Posted by Oki DZ <ok...@pindad.com>.
On Wed, 12 Dec 2001, Carl Gottlieb wrote:
> but I am puzzled as to where and how to specify the parameter.

In the mailet config element in the james.xml:
<mailet match="<some matcher>" class="<your mailet>">
  <paramName>your param</paramName>
</mailet>

Where to put the above, depends on what processor you want to put the
mailet in.

Oki



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>