Ronen Malka
2014-05-16 08:26:41 UTC
Hi,
I am trying to use Restful API plugin ( Restful API plugin
<http://grails.org/plugin/restful-api> ). (using Grails 2.3.8, Groovy 2.1)
As stated in documentation I created a Grails service that implements
RestfulServiceAdapter
<https://raw.githubusercontent.com/restfulapi/restful-api/master/src/groovy/net/hedtech/restfulapi/RestfulServiceAdapter.groovy>
.
import net.hedtech.restfulapi.RestfulServiceAdapter
import com.game.trivia.Question
@Transactional
class QuestionService implements RestfulServiceAdapter {
@Override
public Object list(def service, Map params) throws Throwable{
List Q = Question.list(params)
return Q;
}
.
.
.
When trying to access the service:
`http://localhost:8080/test_triv/api/questions`
I received following exception:
{"errors":[{"type":"general",
"errorMessage":"No signature of method:
test_triv.QuestionService.list() is applicable for argument types:
(org.codehaus.groovy.grails.web.servlet.mvc.GrailsParameterMap)
values:
[[pluralizedResourceName:questions, action:[...], ...]]\nPossible
solutions: list(java.lang.Object, java.util.Map),
is(java.lang.Object), wait(), find(), wait(long),
with(groovy.lang.Closure)"}]}
So I implemented another list method (which is not part of the interface):
public Object list(Map params) throws Throwable {
List Q = Question.list(params)
return Q;
}
Which works ok.
Am I doing something wrong?
Do I implement the correct interface?
Do I have to expose a service for each domain or there is any way to use an
existing controller instead of a service?
Creating new service is a big overhead! I already have controllers for all
domains.
--
View this message in context: http://grails.1312388.n4.nabble.com/Grails-RESTful-API-Plugin-wrong-service-siginiture-tp4656910.html
Sent from the Grails - user mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
I am trying to use Restful API plugin ( Restful API plugin
<http://grails.org/plugin/restful-api> ). (using Grails 2.3.8, Groovy 2.1)
As stated in documentation I created a Grails service that implements
RestfulServiceAdapter
<https://raw.githubusercontent.com/restfulapi/restful-api/master/src/groovy/net/hedtech/restfulapi/RestfulServiceAdapter.groovy>
.
import net.hedtech.restfulapi.RestfulServiceAdapter
import com.game.trivia.Question
@Transactional
class QuestionService implements RestfulServiceAdapter {
@Override
public Object list(def service, Map params) throws Throwable{
List Q = Question.list(params)
return Q;
}
.
.
.
When trying to access the service:
`http://localhost:8080/test_triv/api/questions`
I received following exception:
{"errors":[{"type":"general",
"errorMessage":"No signature of method:
test_triv.QuestionService.list() is applicable for argument types:
(org.codehaus.groovy.grails.web.servlet.mvc.GrailsParameterMap)
values:
[[pluralizedResourceName:questions, action:[...], ...]]\nPossible
solutions: list(java.lang.Object, java.util.Map),
is(java.lang.Object), wait(), find(), wait(long),
with(groovy.lang.Closure)"}]}
So I implemented another list method (which is not part of the interface):
public Object list(Map params) throws Throwable {
List Q = Question.list(params)
return Q;
}
Which works ok.
Am I doing something wrong?
Do I implement the correct interface?
Do I have to expose a service for each domain or there is any way to use an
existing controller instead of a service?
Creating new service is a big overhead! I already have controllers for all
domains.
--
View this message in context: http://grails.1312388.n4.nabble.com/Grails-RESTful-API-Plugin-wrong-service-siginiture-tp4656910.html
Sent from the Grails - user mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email