improved format detection. Need a way for the resource to force a format in their answer.
Fixed incoming and outgoing format detection. Also refactored the response by using ResourceResponse consistently and the _deliverReply() function.