allowedMethods Grails
In grails if you want to map to particular HTTP methods you normally use according to documentation:
static allowedMethods = [action1: 'GET', action2: 'POST']
but for me it does not always properly map my links.
If I use 'def':
def allowedMethod开发者_C百科s = [action1: 'GET', action2: 'POST']
Then the links are mapped correctly but the resource is then not found when using the link.
What?!
I'm not sure what your question is here. The documentation clearly states that this property should be static
, e.g.
static allowedMethods = [action1:'POST', action3: 'POST']
so if you don't declare it as a static property, I'm not surprised that you run into problems.
If you declare the property as shown above and are sure it's not working, then report this as a bug. I expect that the Grails developers will be sceptical about whether this is really a bug in their code, so I strongly recommend including in your report a sample application or unit test that demonstrates the problem.
精彩评论