Backport of JBWEB-281

This is a backport of https://issues.jboss.org/browse/JBWEB-281

It's the same fix (https://source.jboss.org/changelog/JBossWeb?cs=2288)