tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: How to call an external class from a webapp (i.e. - implement a plugin)
Date Wed, 07 Jul 2010 20:25:22 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chuck,

On 7/7/2010 3:48 PM, Caldarale, Charles R wrote:
>> From: Christopher Schultz [mailto:chris@christopherschultz.net] 
>> Subject: Re: How to call an external class from a webapp (i.e. - 
>> implement a plugin)
>> 
>> Another option is to implement your own ClassLoader that scans a
>> directory (such as /my/great/plugins) for JAR files and will load
>> them alongside your webapp's classes.
> 
> Tomcat already has a form of this capability: 
> org.apache.catalina.loader.VirtualWebappLoader
> 
> If you declare this in the className attribute of a <Loader> element
> nested inside the <Context> of interest, you can specify additional
> directories to search for class references.  It exists in all
> supported Tomcat levels, but is only documented in Tomcat 7:
> 
> http://tomcat.apache.org/tomcat-7.0-doc/config/loader.html#VirtualWebappLoader_Implementation

Good to know. I didn't know it was available before TC 7.0 or without
compiling it yourself... I did know that it existed, at least somewhere.

I would tend to favor a ClassLoader that was explicitly used for only
plug-in class loading. I thought you could set a SecurityManager on a
ClassLoader, but my mind must be remembering something else, 'cause it
certainly not in the documentation. :(

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

iEYEARECAAYFAkw04rEACgkQ9CaO5/Lv0PA39QCfVO+whzxqUmTyhJ0/z8dU8IEw
0/UAn3G3FA4sNIkX7m7Jd+A39ZB97+Qa
=aS5e
-----END PGP SIGNATURE-----

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


Mime
View raw message