我正在尝试从我的 Google App Engine webapp 发出 http 请求,并发现我必须使用 URLConnection 因为它是唯一列入白名单的类。对应的Clojure库是clojure.contrib.http.agent,我的代码如下:
(defroutes example
(GET "/" [] (http/string (http/http-agent "http://www.example.com")))
(route/not-found "Page not found"))
这在我的开发环境中运行良好 - 浏览器显示 example.com 的文本。但是当我用谷歌的开发应用服务器测试它时:
phrygian:example wei$ dev_appserver.sh war
2010-09-28 14:53:36.120 java[43845:903] [Java CocoaComponent compatibility mode]: Enabled
...
INFO: The server is running at http://localhost:8080/
它只是在我加载页面时挂起。没有错误,或任何东西。知道会发生什么吗?