One of the main reasons of using resource ref's in code is because you get a level of 
indirection.  I see that level of indirection in the J2EE ref impl from Sun, but I 
don't see that in Tomcat.  How can you specify a datasource (let's say) in the web.xml 
as a res ref different than the one setup in the server.xml.  Is this possible?

Here's an example:
WEB.XML:
<resource-ref id="mail1">

<description>This is used to send email</description>

<res-ref-name>mail/bay4</res-ref-name>

<res-type>javax.mail.Session</res-type>

<res-auth>Container</res-auth>

<res-sharing-scope>Shareable</res-sharing-scope>

</resource-ref>

SERVER.XML:

<Resource name="mail/bay4" auth="Container" type="javax.mail.Session"/> 

<ResourceParams name="mail/bay4"> 

<parameter> <name>mail.smtp.host</name> 

<value>smtp.host.net</value> 

</parameter> 

</ResourceParams> 

-----------
mail/bay4 has to match everywhere, right?  Anyway, this all works just fine for me.  
But I would like to disconnect the reference I use IN CODE, from the resourceparam 
used in the server.xml.  This way I can change the server.xml without affecting the 
deployed WAR file.  You can do this with SUN's Ref impl for the J2EE.


Jim Kennedy
IT Consultant
-----------------------------------------------------




Reply via email to