The Mystery of ProxyPassReverse

The mod_proxy_ajp module for Apache has many advantages over mod_jk for connecting a Tomcat server to an Apache front. For me, the crucial advantage was the ProxyPassReverseCookiePath directive, which allows me to map the session cookies of a Tomcat web application (other than the root application) into the root of a virtual host.

Unfortunately, many tutorials contain misleading advice, and recommend this pattern for the ProxyPassReverse, which will break if the web application issues a redirect:

ProxyPass /jspdir ajp://localhost:8009/jspdir
ProxyPassReverse /jspdir ajp://localhost:8009/jspdir

Read more

Wrapping a Native Library with Maven

I recently converted a large project to build with Maven. The project contained both C++ and Java code, and produced a web application, a standalone server application, plus a number of small command line tools. The project used a large number of open-source Java libraries, and Maven tamed these easily. The native C++ library proved harder, and this is the approach I took.

The code snippets below are part of a complete example that builds a tiny Java/C++ application under Linux. This should port easily to other Unix-like platforms, and may provide some help to performing the same task under Windows. The example is available in tar.gz and zip formats.

Read more