Servlet upgrade patch

REFACTORED code so that servlet 2.5 containers are also supported
FIXED a lot of NPEs
Shouldn't this be an && and not an || ?