Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

GRAILS-11581 Skip handling of method missing for the render method.

  • Loading branch information...
commit afe2a0b0b4a3a20f110ecba787aeff3155e0bbba 1 parent 7bb53fd
@lhotari lhotari authored
View
8 grails-plugin-controllers/src/main/groovy/org/codehaus/groovy/grails/plugins/web/api/ControllersApi.java
@@ -293,6 +293,10 @@ public Object render(Object instance, Object o) {
public Object render(Object instance, String txt) {
return invokeRender(instance, txt);
}
+
+ public Object render(Object instance, CharSequence txt) {
+ return invokeRender(instance, txt);
+ }
public Object render(Object instance, Map args) {
return invokeRender(instance, args);
@@ -306,6 +310,10 @@ public Object render(Object instance, Map args, Closure c) {
return invokeRender(instance, args, c);
}
+ public Object render(Object instance, Map args, CharSequence body) {
+ return invokeRender(instance, args, body);
+ }
+
protected Object invokeRender(Object instance, Object... args) {
return render.invoke(instance, RENDER_METHOD_NAME, args);
}
View
29 grails-plugin-gsp/src/ast/groovy/org/codehaus/groovy/grails/plugins/web/api/ControllerTagLibraryApi.java
@@ -77,24 +77,29 @@ public void setGspTagLibraryLookup(TagLibraryLookup lookup) {
*/
public Object methodMissing(Object instance, String methodName, Object argsObject) {
Object[] args = argsObject instanceof Object[] ? (Object[])argsObject : new Object[]{argsObject};
- TagLibraryLookup lookup = getTagLibraryLookup();
- if (lookup != null) {
- GroovyObject tagLibrary = lookup.lookupTagLibrary(GroovyPage.DEFAULT_NAMESPACE, methodName);
- if (tagLibrary != null) {
- if (!developmentMode) {
- MetaClass controllerMc = GrailsMetaClassUtils.getMetaClass(instance);
- WebMetaUtils.registerMethodMissingForTags(controllerMc, lookup, GroovyPage.DEFAULT_NAMESPACE, methodName);
- }
- List<MetaMethod> respondsTo = tagLibrary.getMetaClass().respondsTo(tagLibrary, methodName, args);
- if (respondsTo.size()>0) {
- return respondsTo.get(0).invoke(tagLibrary, args);
+ if(shouldHandleMethodMissing(instance, methodName, args)) {
+ TagLibraryLookup lookup = getTagLibraryLookup();
+ if (lookup != null) {
+ GroovyObject tagLibrary = lookup.lookupTagLibrary(GroovyPage.DEFAULT_NAMESPACE, methodName);
+ if (tagLibrary != null) {
+ if (!developmentMode) {
+ MetaClass controllerMc = GrailsMetaClassUtils.getMetaClass(instance);
+ WebMetaUtils.registerMethodMissingForTags(controllerMc, lookup, GroovyPage.DEFAULT_NAMESPACE, methodName);
+ }
+ List<MetaMethod> respondsTo = tagLibrary.getMetaClass().respondsTo(tagLibrary, methodName, args);
+ if (respondsTo.size()>0) {
+ return respondsTo.get(0).invoke(tagLibrary, args);
+ }
}
}
}
-
throw new MissingMethodException(methodName, instance.getClass(), args);
}
+ protected boolean shouldHandleMethodMissing(Object instance, String methodName, Object[] args) {
+ return !"render".equals(methodName);
+ }
+
/**
* Looks up namespaces on missing property
*
Please sign in to comment.
Something went wrong with that request. Please try again.