[GEOS-5985] Tomcat with APR can result in full JVM crashes

Updated patch using a servlet filter