You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Oliver Block <li...@oliver-block.eu> on 2009/06/20 03:18:51 UTC

Access to configuration values

Hello everybody,

I started to use Tomcat 6 for a mail web application - which is coded in php 
at the moment. I followed the JNDI-Resources HOW-TO to make use of JavaMail 
Sessions. As recommended under 3. Configure Tomcat's Resource Factory I 
copied the Resource tag to my context.xml in the web application project. 

<Resource name="mail/Session" auth="Container"
            type="javax.mail.Session"
            mail.smtp.host="localhost"/>

How cat I make use of mail.smtp.host in my code, in oder to avoid hard-coding 
the hostname?

And, is it also ok to specify an imap store in the resource descriptor? If so, 
would it be 'mail.imap.store' ?

Best Regards,

Oliver Block


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Access to configuration values

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Oliver,

On 6/19/2009 9:18 PM, Oliver Block wrote:
> I started to use Tomcat 6 for a mail web application - which is coded in php 
> at the moment. I followed the JNDI-Resources HOW-TO to make use of JavaMail 
> Sessions. As recommended under 3. Configure Tomcat's Resource Factory I 
> copied the Resource tag to my context.xml in the web application project. 
> 
> <Resource name="mail/Session" auth="Container"
>             type="javax.mail.Session"
>             mail.smtp.host="localhost"/>
> 
> How cat I make use of mail.smtp.host in my code, in oder to avoid hard-coding 
> the hostname?

I would use a <context-param> in web.xml or <Parameter> in context.xml.

See
Servlet Specification 2.5 section SRV.4.3 (Context Initialization
Parameters)
and
> http://tomcat.apache.org/tomcat-6.0-doc/config/context.html#Context%20Parameters

> And, is it also ok to specify an imap store in the resource descriptor? If so, 
> would it be 'mail.imap.store' ?

I have no idea. If it works, it's probably okay!

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkpG3CQACgkQ9CaO5/Lv0PCf7ACfUY/y6CTLBlQzlHwaFLM/qqDy
w7gAoK0pl1tSsyKPOnw157XHhUCsmrm3
=K/uz
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org