tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Tomcat Inner Gold Mine
Date Sun, 13 May 2007 13:25:59 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Johnny,

Johnny Kewl wrote:
> Often in a tomcat application I use separate XML files for
> configuration. I normally end up using a lite weight sax parser that
> I wrote especially for this, but every time I do this... I think to
> myself... I'm just doing what has already been done in tomcat.

I'm not sure if Tomcat uses this itself, but you might want to check out
the Jakarta commons "digester". If you play your cards right, you can
parse XML files without writing any additional code. Of course, if you
need to parse files /fast/, it's probably not the best solution, but if
you're talking about one-time configuration-file parsing, then it's perfect.

> I dont imagine that these internal libs are exposed in a normal
> tomcat application, unless i'm missing something, but I was wondering
> if its not possible to get at the libraries almost as its done in
> embedded tomcat, so one can reduce the overhead of duplicate
> functionality.

It looks like Tomcat 6 gives access to 100% of the Tomcat libraries to
all loaded webapps.

> For example if one went for a similar parameter structure in a
> separate xml file... its in not possible to get at that using a
> tomcat lib?

I'm not sure you'd want to do this: see below.

> If so I'd imagine there is a whole range of tricks one could use... 
> In theory a user should never have to go find a base64 lib, or an MD5
> lib etc etc... nor anything else that Tomcat has to use????

For cryptography (like MD5), you shouldn't be writing your own stuff,
anyway. Use the JCE, which should be available in any recent JRE or JDK
version.

> I think there is a lot of very standard stuff that tomcat could
> expose through an API... if it has an Xerces lib, why make a user get
> another one?

If you've ever had problems with the local Java's XML libraries or the
application server's libraries interfering with those required by your
webapp, you'd know why this isn't a good idea. Without library
isolation, you can have a webapp that runs just fine on one version of
the server (or even JRE), but fails miserably on another with only a
slightly different configuration difference. :(

Another reason not to do it is that it will couple your application to
Tomcat, and possibly to a specific version of Tomcat. If you want to
distribute your application, it's bad form to mandate the app server
required to deploy it. WAR files ought to be entirely self-contained
(except for those APIs defined to be available by the servlet spec).

It may seem "heavier", but it sure it safer and more robust.

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

iD4DBQFGRxHn9CaO5/Lv0PARAhFMAJdk2wEIBdcAnH69NOLgctihsHn4AJ45m2du
m/UMmQNsxOWoqzyeOUpWTA==
=KKb6
-----END PGP SIGNATURE-----

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


Mime
View raw message