Hi,

I have made some improvements and refactorings to the Tomcat OWB
integration. The code is available here:
https://github.com/rmaucher/tomcat-owb

The changes are roughly:
- I expected this would be a Tomcat external module (like JDBC pool), so
the code was changed to have the Tomcat code style, i18n, package rename
(it can be reverted), refactorings, etc.
- Works as a listener on the Server element, which would CDI enable the
container. The listener can be a good location for configuration in the
future. Various listener event timing issues prevented the tomcat7
integration from working this way. It still has a listener at the context
level, so the integration can be used at the individual webapp level as
well.
- Requires Tomcat 9.0.21+ due to the said event changes plus some utility
class to avoid code duplication.
- Using this integration code, the pom builds a semi fat jar which can be
put in the Tomcat lib folder, then the listener should be added to
server.xml. I have verified CDI extension support is functional.
- I have tested that CXF (with the right packaging), and the Geronimo MP
impl JARs (without needing a "right" packaging ;) ) work well with this OWB
support using said CDI extension support.

The shade packaging pom would be somewhere in Tomcat (like the packaging
I'm using for container and graal test bed:
https://github.com/apache/tomcat/tree/master/res/tomcat-maven ), but the
code needs to be somewhere. As I said I planned to host it at
https://github.com/apache/tomcat/tree/master/modules but, unexpectedly, OWB
community members said it should be in OWB.

If the code is picked up in OWB, I'd recommend:
- Package renaming back to org.apache.webbeans.web.tomcat (I'm not a fan of
"tomcat9", it ends up looking bad and/or outdated in the configuration,
like "tomcat7" does these days).
- Keeping "OpenWebBeans" in class names. Although it's not the usual
convention here, the classnames do appear in Tomcat configuration, its
monitoring with JMX, and it's more obvious this way.
"org.apache.webbeans.web.tomcat9.TomcatListener" in server.xml works I
guess, but "org.apache.webbeans.web.tomcat.OpenWebBeansListener" looks
better. Overall, only OpenWebBeansPlugin and OpenWebBeansSecurityService
could lose the "OpenWebBeans" name in favor of "Tomcat" (or whatever name).
- Keep the Tomcat i18n since it doesn't hurt.
- No idea about the code formatting, I'm ok if it is changed back.

Rémy

Reply via email to