我有一个服务运行在这个url:http:// localhost:8888
我通过调用它得到这个服务的结果:
http://localhost:8888/colors?colorname=red&shade=dark
我得到的JSON结果如下:
{ "request#": 55,"colorname": "red","shade": "dark","available": "No" }
题
在我的Grails应用程序中可以使用哪种方式来使用这项服务?
解决方法
假设所有的配置都在
rest client builder,那么你最终会得到2
将服务行代码作为:
将服务行代码作为:
//controller/service/POGO def resp = rest.get("http://localhost:8888/colors?colorname=red&shade=dark") resp.json //would give the response JSON
哪里
//resources.groovy beans = { rest(grails.plugins.rest.client.RestBuilder) }
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。