I have a JS app that sets an iframe URL targetting my appengine service. Intermittently the returned page has a content type of ‘application/json’ instead of ‘text/html’. Repeating the invocation always serves as “text/html”.
This is what Chrome captures
Request URL:http://www.clevernote.co/app/editpopupG.jsp?u=https://docs.google.com/feeds/download/documents/export/Export?id=1mc_hXOOP-PppCn3GebeGREBRDKLSXp2R1R2ij2_ki_A&exportFormat=html&t=google%20integration&i=1mc_hXOOP-PppCn3GebeGREBRDKLSXp2R1R2ij2_ki_A
Request Method:GET
Status Code:200 OK
Request Headersview source
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Connection:keep-alive
Cookie:oauth2-token=; JSESSIONID=DHwIAl
Host:www.clevernote.co
Referer:http://www.clevernote.co/app/main.jsp
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.77 Safari/537.1
Query String Parametersview URL encoded
u:https://docs.google.com/feeds/download/documents/export/Export
Response Headersview source
Cache-Control:no-cache
Content-Encoding:gzip
Content-Length:1544
Content-Type:application/json; charset=UTF-8
Date:Sun, 23 Sep 2012 02:49:37 GMT
Server:Google Frontend
Vary:Accept-Encoding
If I reload the page, the response is correctly “text/html”
Content …
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- CSS -->
<link href="../css/cnw ... etc
You can set the content type directly in the servlet.