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 19:36:56 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Goren,

On 7/6/2010 10:51 AM, Goren Il wrote:
>  There are 2 issues (not in order of priority):
> 1. The steps are not straight forward, and may cause the system to stop
> working (the customer should change the WAR suffix to "zip", open it,
> add the files and rename it back)

There isn't really a reason why the above shouldn't work.

> 2. When we provide a new version, we will replace the WAR and all the
> changes are gone.

Fair enough, but the customer can re-install their plug-ins.

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.

You'll either have to chain that ClassLoader into the standard webapp
ClassLoader provided by Tomcat for transparent class-loading by your
webapp, or write a wrapper for plug-in loading and execution by
explicitly managing and invoking that ClassLoader as necessary.

You should seriously consider how to implement security mechanisms when
loading classes that you do not provide yourself.

> I would like my webapp to call an external class, which will be
> provided (as a name) in an XML file at run time.

How does your webapp load this XML file if it isn't packaged in the WAR
file?

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

iEYEARECAAYFAkw011gACgkQ9CaO5/Lv0PAO9QCfRRfexlNsGjxh5pg2pHKlzbWC
XVEAoKaBL2jk5i10EIY2DDQt6wcP4vc/
=VS3H
-----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