Response api refactoring because of incompatibility with HttpServletResponse