Extract common code from servlets into abstract base class