ruthst00 commented on code in PR #16516:
URL: https://github.com/apache/grails-core/pull/16516#discussion_r4217515634


##########
grails-web-url-mappings/src/main/groovy/org/grails/web/mapping/mvc/UrlMappingsInfoHandlerAdapter.groovy:
##########
@@ -161,11 +161,20 @@ class UrlMappingsInfoHandlerAdapter implements 
HandlerAdapter, ApplicationContex
                     }
                 }
 
+                // render(view:) sets MODEL_AND_VIEW on the request and does 
not set renderView=false,
+                // so this path is always intentional view resolution — honour 
it unconditionally.
                 def modelAndView = 
request.getAttribute(GrailsApplicationAttributes.MODEL_AND_VIEW)
                 if (modelAndView instanceof ModelAndView) {
                     return (ModelAndView) modelAndView
                 }
-                else if (result instanceof Map) {
+                // All other render() variants (template, text, JSON, file, 
closure, object) set
+                // webRequest.renderView = false. If that flag is clear the 
response has already been
+                // handled; returning a ModelAndView here would cause 
DispatcherServlet to attempt
+                // view resolution and throw "Could not resolve view". (#15819)
+                if (!webRequest.renderView) {

Review Comment:
   @jamesfredley, thank you for your feedback. I agree the correct fix is to 
check the raw `renderView` field (not the composite `isRenderView()`), so I 
added a method to `GrailsWebRequest` that exposes just the field value without 
the composite checks. Hopefully this fixes the problem: 
https://github.com/apache/grails-core/pull/16516/changes/ba4575019ce032554682711fcd2c16c84d52845c
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to