0

When we use the resource attribute to define a mapping like "/api/user"(resource: 'user') the following mappings are created by Grails:

"/api/user/create"(controller: 'user', action: 'create', method: 'GET') "/api/user/edit"(controller: 'user', action: 'edit', method: 'GET') "/api/user(.(*))?"(controller: 'user', action: 'delete', method: 'DELETE') "/api/user(.(*))?"(controller: 'user', action: 'update', method: 'PUT') "/api/user(.(*))?"(controller: 'user', action: 'save', method: 'POST') 

Well, what I want to do it to change these defaults so that I can translate the actions to my native language. So when I create a resource, I want those actions to be: "criar, editar, deletar, atualizar, salvar".

Is that possible? How can I accomplish that?

Thanks in advance.

1 Answer 1

1

You should probably write a new RestfulController implementation (basing on @Resource AST (Abstract Syntax Tree) annotation, which we can use as the superClass).

Check this out: http://mrhaki.blogspot.com/2014/07/grails-goodness-custom-controller-class.html

And base on RestfulController implemetation: https://github.com/grails/grails-core/blob/master/grails-plugin-rest/src/main/groovy/grails/rest/RestfulController.groovy

Sign up to request clarification or add additional context in comments.

1 Comment

That seems promising. Thanks, I'll try that.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.