Extract response writer so that it's reusable outside the view handler.