SSP-904, SSP-846 Emit valid JSON in error pages

Part of this involved just making sure the JSON itself was syntactically
valid (that's the SSP-846 portion). The other part involved fixes
specifically for file upload (SSP-904) where we need to set a text/html
content type on these pages, even though they emit json, so that
browser's don't wrap the response in markup when writing it into an
iframe, thereby invalidating the JSON string from Ext.js's
perspective. More details in 500.jsp.