Moved redirect function to the bottom of the class, added two new "send" functions for the common case of returning an object followed by a close, one of them also converts the object to json format and set content-type to json.