data = null Grails中的withRest(rest客户端)

时间:2012-10-26 15:04:35

标签: grails grails-2.0 httpbuilder

我在grails中遇到HTTPBuilder rest客户端的问题。代码如下:

withHttp(uri: "http://uclassify.com") {
                println "fetching comment sentiments for " + comment.content
                get(path : '/browse/uClassify/Sentiment/ClassifyText/', query : [readkey: key, text: comment.content, version: '1.01'], requestContentType: ContentType.XML){resp, data ->
                    println "data:"
                    println resp.getData()
                    println "status"
                    println resp.getStatus()
                    println "status line"
                    println resp.getStatusLine()
                    println "headers"
                    println resp.getAllHeaders()

                    println "data again"
                    println data        
                    println "finished"
                }

与firebug和curl中显示的标头相比,标头返回正确,但响应的主体始终为null。内容长度383意味着服务器返回数据(与firebug中的标题相比大小相同)。

这是生产的标准输出。

fetching comment sentiments for something
data:
null
status
200
status line
HTTP/1.1 200 OK
headers
[Date: Fri, 26 Oct 2012 14:55:40 GMT, Server: Microsoft-IIS/6.0, X-Powered-By: ASP.NET, X-AspNet-Version: 2.0.50727, Set-Cookie: ASP.NET_SessionId=ipttqq55rini0t555i53zmvd; path=/; HttpOnly, Cache-Control: private, Content-Type: text/xml; charset=utf-8, Content-Length: 383]
data again

finished
fetching comments complete

任何想法或建议?

由于

0 个答案:

没有答案