Discussion:
Exposing REST services in custom plugins
alikay
2014-05-07 18:02:24 UTC
Permalink
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.
Anne





--
View this message in context: http://grails.1312388.n4.nabble.com/Exposing-REST-services-in-custom-plugins-tp4656662.html
Sent from the Grails - dev mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Loading...