tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jim Kennedy" <j...@gigaheads.com>
Subject Resource references
Date Fri, 23 May 2003 19:11:46 GMT
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.  This
question is more one of what seems to be inconsistencies.



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



Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message