html - 请求错误 (invalid_request) - Android 浏览器

标签 html http request

我有一个本地运行的基本 Jetty 服务器。如果我拉起 http://localhost/servlet1在桌面上的网络浏览器中,我能够看到正确的内容(基本 html 页面)。但是,当我在 Android 模拟器 (2.2) 中导航到此站点时,出现以下错误:

Request Error (invalid_request) Your request could not be processed.

Request could not be handled This could be caused by a misconfiguration, or possibly a malformed request.

For assistance, contact your network support team.

知道可能是什么问题吗?如果这个基本任务不起作用,我不敢继续前进。

最佳答案

由于模拟器中网络堆栈的性质,您不能使用“localhost”或 127.0.0.1 连接到主机。尝试改用 10.0.2.2,因此:http://10.0.2.2/servlet1

来自 http://code.google.com/p/android/issues/detail?id=133 :

127.0.0.1 is the emulated system's own loopback interface, not the one running on your host development machine.

within the Android system, one should use 10.0.2.2 which is an alias specifically setup to contact your host 127.0.0.1

关于html - 请求错误 (invalid_request) - Android 浏览器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3816761/

相关文章:

html - 使用不带 CSS3 的 HTML 或 CSS 将任意长度的 div 系列拆分为列

python - 在Django中获取页面动态标题的好方法是什么?

http - 在 Golang 中处理并发 HTTP 请求

html - 防止子div在调整页面大小时溢出其父容器

java - 请求参数的存在应评估为真

nc 收到时的 HTTP 错误响应

c# - Request.UserHostAddress 和 Request.ServerVariables ["REMOTE_ADDR".ToString() 有什么区别

php - 使用wordpress处理ajax请求响应

swift - Alamofire 请求已取消 (-999)

jquery - anchor 悬停背景颜色按百分比变化