【发布时间】:2012-09-23 03:28:53
【问题描述】:
我有一个 JS 应用程序,它设置了一个针对我的 appengine 服务的 iframe URL。返回的页面间歇性地具有“application/json”而不是“text/html”的内容类型。重复调用始终充当“text/html”。
这就是 Chrome 捕获的内容
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
如果我重新加载页面,响应是正确的“text/html”
内容...
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- CSS -->
<link href="../css/cnw ... etc
【问题讨论】:
-
上面的url不是Appengine的,那和Appengine有什么关系呢?
-
网址是来自 Appengine!如果有帮助,我很乐意将其指定为 clever-note.appspot.com。
-
如果我尝试该 url,我会得到“错误:服务器错误”?
-
没错。我发布的 URL 来自我的应用程序,其中包含指向我的一个文档的链接,您无法访问该链接。它被设计为在我的应用程序中被称为 iframe,而不是直接将浏览器指向它。我真的很感激你的努力,但你不会通过调用 URL 来了解我的问题。会发生两件事之一,要么你会得到我在上面粘贴的响应(即 Content-Type 'application/json',要么你会得到我上面粘贴的 Content-Type'text/html' 的响应。在在这两种情况下,HTML 内容是相同的。
-
App Engine 没有更改内容类型 - 您正在设置它或未能在某处设置它。如果没有看到您的代码,我们可能无法弄清楚在哪里或为什么。