java ResponseBuilder toString()以字符串形式返回对象类,而不仅仅是原始响应字符串
我目前正在从Java ASK-SDK v1迁移到Java ASK SDK v2
我试图使用我建立的ResponseBuilder
类返回webhook调用,并且数据是正确的,但是当我试图用JSON文本填充HTTP正文时,ResponseBuilder.toString()
值不仅仅用字符串填充数据,我得到以下结果:
Optional[class Response {
outputSpeech: class SsmlOutputSpeech {
class OutputSpeech {
type: SSML
playBehavior: null
}
ssml: <speak>Some of the things you can say are What would you like to do?</speak>
}
card: null
reprompt: class Reprompt {
outputSpeech: class SsmlOutputSpeech {
class OutputSpeech {
type: SSML
playBehavior: null
}
ssml: <speak>You can say ..., is that what you want?</speak>
}
}
directives: []
shouldEndSession: false
canFulfillIntent: null
}]
有没有其他方法可以获取响应主体的字符串?BaseSkillResponse有一个getResponse()
调用,但是,我不知道如何使用该类生成字符串响应输出
# 1 楼答案
通过执行以下操作解决此问题:
# 2 楼答案
在我的课堂上,我能够通过以下方式获得字符串: