我正在“管道”从外部服务返回的 json 提要(在某些情况下相当大),以隐藏客户端的访问 api 密钥(访问密钥是该服务唯一可用的身份验证系统)。
我正在使用 Gaelyk,我写了这个 groovlet:
try {
feed(params.topic)
} catch(Exception e) {
redirect "/failure"
}
def feed(topic) {
URL url = new URL("https://somewhere.com/$topic/<apikey>/feed")
def restResponse = url.get()
if (restResponse.responseCode == 200) {
response.contentType = 'application/json'
out << restResponse.text
}
}
唯一的问题是“restResponse”非常大,并且 groovlet 返回的值被截断。所以我会得到一个这样的json:
[{"item":....},{"item":....},{"item":....},{"ite
如何在不截断的情况下返回完整的 json?