dev_appserver
我发现 Java和实时 App Engine 服务器之间存在不一致。
在我的本地开发服务器上,我有一个 Servlet,它返回:
return response.sendError(response.SC_BAD_REQUEST, "Please log in to comment");
当我访问该页面时,我会在标题中返回一条状态代码消息:
Status Code:400 Please log in to comment
当我将它部署到 App Engine 时,问题就出现了。访问同一个 servlet 时,我收到此“错误请求”而不是“请登录以发表评论”:
Status Code:400 Bad Request
状态代码消息出现Please log in to comment
在内容 HTML 中,但不像在开发环境中那样出现在标题中。
为什么是这样?
编辑
这是curl -vvvv
dev_appserver 和生产的跟踪:
dev_appserver 卷曲跟踪:
> POST /add-comment HTTP/1.1
> User-Agent: Mozilla/4.0
> Host: localhost:8080
> Accept: */*
> Content-Length: 9
> Content-Type: application/x-www-form-urlencoded
>
< HTTP/1.1 400 Please log in to comment
< Content-Type: text/html; charset=iso-8859-1
< Cache-Control: must-revalidate,no-cache,no-store
< Content-Length: 1406
< Server: Jetty(6.1.x)
生产卷曲痕迹:
> POST /add-comment HTTP/1.1
> User-Agent: Mozilla/4.0
> Host: www.xxx.org
> Accept: */*
> Content-Length: 9
> Content-Type: application/x-www-form-urlencoded
>
< HTTP/1.1 400 Bad Request
< Content-Type: text/html; charset=utf-8
< Vary: Accept-Encoding
< Date: Thu, 18 Aug 2011 14:04:26 GMT
< Server: Google Frontend
< Cache-Control: private
< Transfer-Encoding: chunked