【发布时间】:2011-10-09 00:42:42
【问题描述】:
我一直在寻找整个互联网,试图找到一个如何做到这一点的例子。我只想使用外部 REST 服务器,但我不知道如何设置外部服务器的 url,请帮助
import static org.grails.jaxrs.response.Responses.*
import javax.ws.rs.Consumes
import javax.ws.rs.GET
import javax.ws.rs.Produces
import javax.ws.rs.Path
import javax.ws.rs.PathParam
import javax.ws.rs.POST
import javax.ws.rs.core.Response
**@Path('http://localhost:8080/prueba3/api/person')**
@Consumes(['application/xml','application/json'])
@Produces(['application/xml','application/json'])
class PersonCollectionResource {
@POST
Response create(Person dto) {
created dto.save()
}
@GET
Response readAll() {
ok Person.findAll()
}
@Path('/{id}')
PersonResource getResource(@PathParam('id') String id) {
new PersonResource(id:id)
}
}
【问题讨论】: