Exposing REST services in custom plugins

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Exposing REST services in custom plugins

The following scenario was done with Grails 2.3.6.  

In my custom plugin, I have created a simple domain object called “TestMe”.  I have also created a corresponding controller called “TestMeController” with default scaffolding - “static scaffold = TestMe” with no actions overridden.

I expose the REST services in my plugin’s UrlMappings file as follows:

static mappings = {
            "/tests"(resources: 'testMe', includes:['index'], format:['json','xml','html'])

I install this plugin in my parent app and the REST services work as expected.  http://localhost:8080/tests.<format> responds with the correct data.  Specifically, the HTML request results in the scaffolded index page.  So far so good.

However, when I create my own index.gsp in my plugin (in views/testMe), the respond still renders the default scaffolded index page rather than my custom one.  (I completely cleaned my project directory to no avail.)

I also tried to explicitly define an index action in my plugin’s controller and putting a view parameter in the respond ( “view: ‘/testMe/index’ ).  This did not have any effect.

Is there a way to get the respond to render my custom views from my plugin?  I looked in ControllersRestApi and did not see an obvious way to do this.

Thanks for any info.