Skip to content

Commit afe2a0b

Browse files
committed
GRAILS-11581 Skip handling of method missing for the render method.
1 parent 7bb53fd commit afe2a0b

File tree

2 files changed

+25
-12
lines changed

2 files changed

+25
-12
lines changed

grails-plugin-controllers/src/main/groovy/org/codehaus/groovy/grails/plugins/web/api/ControllersApi.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,10 @@ public Object render(Object instance, Object o) {
293293
public Object render(Object instance, String txt) {
294294
return invokeRender(instance, txt);
295295
}
296+
297+
public Object render(Object instance, CharSequence txt) {
298+
return invokeRender(instance, txt);
299+
}
296300

297301
public Object render(Object instance, Map args) {
298302
return invokeRender(instance, args);
@@ -306,6 +310,10 @@ public Object render(Object instance, Map args, Closure c) {
306310
return invokeRender(instance, args, c);
307311
}
308312

313+
public Object render(Object instance, Map args, CharSequence body) {
314+
return invokeRender(instance, args, body);
315+
}
316+
309317
protected Object invokeRender(Object instance, Object... args) {
310318
return render.invoke(instance, RENDER_METHOD_NAME, args);
311319
}

grails-plugin-gsp/src/ast/groovy/org/codehaus/groovy/grails/plugins/web/api/ControllerTagLibraryApi.java

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -77,24 +77,29 @@ public void setGspTagLibraryLookup(TagLibraryLookup lookup) {
7777
*/
7878
public Object methodMissing(Object instance, String methodName, Object argsObject) {
7979
Object[] args = argsObject instanceof Object[] ? (Object[])argsObject : new Object[]{argsObject};
80-
TagLibraryLookup lookup = getTagLibraryLookup();
81-
if (lookup != null) {
82-
GroovyObject tagLibrary = lookup.lookupTagLibrary(GroovyPage.DEFAULT_NAMESPACE, methodName);
83-
if (tagLibrary != null) {
84-
if (!developmentMode) {
85-
MetaClass controllerMc = GrailsMetaClassUtils.getMetaClass(instance);
86-
WebMetaUtils.registerMethodMissingForTags(controllerMc, lookup, GroovyPage.DEFAULT_NAMESPACE, methodName);
87-
}
88-
List<MetaMethod> respondsTo = tagLibrary.getMetaClass().respondsTo(tagLibrary, methodName, args);
89-
if (respondsTo.size()>0) {
90-
return respondsTo.get(0).invoke(tagLibrary, args);
80+
if(shouldHandleMethodMissing(instance, methodName, args)) {
81+
TagLibraryLookup lookup = getTagLibraryLookup();
82+
if (lookup != null) {
83+
GroovyObject tagLibrary = lookup.lookupTagLibrary(GroovyPage.DEFAULT_NAMESPACE, methodName);
84+
if (tagLibrary != null) {
85+
if (!developmentMode) {
86+
MetaClass controllerMc = GrailsMetaClassUtils.getMetaClass(instance);
87+
WebMetaUtils.registerMethodMissingForTags(controllerMc, lookup, GroovyPage.DEFAULT_NAMESPACE, methodName);
88+
}
89+
List<MetaMethod> respondsTo = tagLibrary.getMetaClass().respondsTo(tagLibrary, methodName, args);
90+
if (respondsTo.size()>0) {
91+
return respondsTo.get(0).invoke(tagLibrary, args);
92+
}
9193
}
9294
}
9395
}
94-
9596
throw new MissingMethodException(methodName, instance.getClass(), args);
9697
}
9798

99+
protected boolean shouldHandleMethodMissing(Object instance, String methodName, Object[] args) {
100+
return !"render".equals(methodName);
101+
}
102+
98103
/**
99104
* Looks up namespaces on missing property
100105
*

0 commit comments

Comments
 (0)