From fcc8bf0ba4776285ee943d9ec09cdfeae87bbeb7 Mon Sep 17 00:00:00 2001 From: James Daugherty Date: Sat, 30 Nov 2024 21:40:33 -0500 Subject: [PATCH 1/5] Mark dispatch action as deprecated due to grails-gsp#551 --- .../org/grails/web/mapping/DefaultUrlMappingInfo.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/grails-web-url-mappings/src/main/groovy/org/grails/web/mapping/DefaultUrlMappingInfo.java b/grails-web-url-mappings/src/main/groovy/org/grails/web/mapping/DefaultUrlMappingInfo.java index 5a99076ad0d..fbf98eaff6c 100644 --- a/grails-web-url-mappings/src/main/groovy/org/grails/web/mapping/DefaultUrlMappingInfo.java +++ b/grails-web-url-mappings/src/main/groovy/org/grails/web/mapping/DefaultUrlMappingInfo.java @@ -212,6 +212,13 @@ public String getId() { return evaluateNameForValue(id); } + /** + * @deprecated + * This method will be removed in a future grails version since the associated g:submitAction is being removed. + * Grails will no longer support redirecting to a different action name by adding a parameter with the prefix + * '_action' + */ + @Deprecated(since = "7.0.0") private String checkDispatchAction(HttpServletRequest request) { if (request.getAttribute(WebUtils.EXCEPTION_ATTRIBUTE) != null || WebUtils.isForwardOrInclude(request)) { return null; From 81f165f9784b0bc1669d4ec7d246069f0eb5b531 Mon Sep 17 00:00:00 2001 From: James Daugherty Date: Sat, 30 Nov 2024 22:21:08 -0500 Subject: [PATCH 2/5] Add comment concerning grails-gsp #551 and future deprecation --- UPGRADE7.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/UPGRADE7.md b/UPGRADE7.md index 88625842b70..24762172ed4 100644 --- a/UPGRADE7.md +++ b/UPGRADE7.md @@ -9,10 +9,13 @@ Experienced while upgrading modules for Grails 7 - Jar artifacts produced by Grails Plugins will no longer have the suffix `-plain` - https://github.com/grails/grails-gradle-plugin/pull/347 - [GROOVY-5169](https://issues.apache.org/jira/browse/GROOVY-5169) [GROOVY-10449](https://issues.apache.org/jira/browse/GROOVY-10449) - - Fields with a public modifier were not returned with MetaClassImpl#getProperties() in groovy 3, but are now. + - Fields with a public modifier were not returned with MetaClassImpl#getProperties() in groovy 3, but are now. ## NOTE: This document is a draft and the explanations are only highlights and will be expanded further prior to release of 7.0. +## New Features +- [grails-gsp #551](https://github.com/grails/grails-gsp/issues/551) adopts a `formActionSubmit` tag to replace `actionSubmit`. Dispatching actions via a parameter name on a form submit will be removed in a future version of grails. + ### Cool New Features - You can now @Scaffold Controllers and Services and virtually eliminate any boiler plate code. - Hello Exterminator, Good by bugs! Lot's of things started working... and working well! For instance, use of controller namespaces now work seemlessly. From 38ef71d0498e5b32cff8df5a060185c21cd6fdd6 Mon Sep 17 00:00:00 2001 From: James Daugherty Date: Sun, 1 Dec 2024 16:28:49 -0500 Subject: [PATCH 3/5] Add warning message on deprecation --- .../org/grails/web/mapping/DefaultUrlMappingInfo.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/grails-web-url-mappings/src/main/groovy/org/grails/web/mapping/DefaultUrlMappingInfo.java b/grails-web-url-mappings/src/main/groovy/org/grails/web/mapping/DefaultUrlMappingInfo.java index fbf98eaff6c..6390910e15a 100644 --- a/grails-web-url-mappings/src/main/groovy/org/grails/web/mapping/DefaultUrlMappingInfo.java +++ b/grails-web-url-mappings/src/main/groovy/org/grails/web/mapping/DefaultUrlMappingInfo.java @@ -32,6 +32,8 @@ import grails.core.GrailsApplication; import grails.web.mapping.UrlMappingInfo; import grails.web.mapping.exceptions.UrlMappingException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.grails.web.servlet.mvc.GrailsWebRequest; import org.grails.web.util.WebUtils; import org.springframework.context.ApplicationContext; @@ -49,6 +51,7 @@ */ public class DefaultUrlMappingInfo extends AbstractUrlMappingInfo { + private static final Log LOG = LogFactory.getLog(DefaultUrlMappingInfo.class); private static final String SETTING_GRAILS_WEB_DISABLE_MULTIPART = "grails.web.disable.multipart"; private static final String CONTROLLER_PREFIX = "controller:"; private static final String ACTION_PREFIX = "action:"; @@ -238,6 +241,11 @@ private String checkDispatchAction(HttpServletRequest request) { break; } } + + if (LOG.isWarnEnabled() && dispatchActionName != null) { + LOG.warn(String.format("Dispatch Action [%s] detected; Dispatch Actions will be removed in a future version of Grails.", dispatchActionName)); + } + return dispatchActionName; } From 21556879a040aff62952770ff6d95c0331f6a717 Mon Sep 17 00:00:00 2001 From: James Daugherty Date: Mon, 2 Dec 2024 10:11:26 -0500 Subject: [PATCH 4/5] feedback - add forRemoval = true --- .../groovy/org/grails/web/mapping/DefaultUrlMappingInfo.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grails-web-url-mappings/src/main/groovy/org/grails/web/mapping/DefaultUrlMappingInfo.java b/grails-web-url-mappings/src/main/groovy/org/grails/web/mapping/DefaultUrlMappingInfo.java index 6390910e15a..6150a441041 100644 --- a/grails-web-url-mappings/src/main/groovy/org/grails/web/mapping/DefaultUrlMappingInfo.java +++ b/grails-web-url-mappings/src/main/groovy/org/grails/web/mapping/DefaultUrlMappingInfo.java @@ -221,7 +221,7 @@ public String getId() { * Grails will no longer support redirecting to a different action name by adding a parameter with the prefix * '_action' */ - @Deprecated(since = "7.0.0") + @Deprecated(since = "7.0.0", forRemoval = true) private String checkDispatchAction(HttpServletRequest request) { if (request.getAttribute(WebUtils.EXCEPTION_ATTRIBUTE) != null || WebUtils.isForwardOrInclude(request)) { return null; From a1d2263530f747df55f271dfc437511e85d36900 Mon Sep 17 00:00:00 2001 From: James Daugherty Date: Mon, 2 Dec 2024 20:10:51 -0500 Subject: [PATCH 5/5] feedback - change message to indicate what needs changed --- .../groovy/org/grails/web/mapping/DefaultUrlMappingInfo.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grails-web-url-mappings/src/main/groovy/org/grails/web/mapping/DefaultUrlMappingInfo.java b/grails-web-url-mappings/src/main/groovy/org/grails/web/mapping/DefaultUrlMappingInfo.java index 6150a441041..72f0cd9fddf 100644 --- a/grails-web-url-mappings/src/main/groovy/org/grails/web/mapping/DefaultUrlMappingInfo.java +++ b/grails-web-url-mappings/src/main/groovy/org/grails/web/mapping/DefaultUrlMappingInfo.java @@ -243,7 +243,7 @@ private String checkDispatchAction(HttpServletRequest request) { } if (LOG.isWarnEnabled() && dispatchActionName != null) { - LOG.warn(String.format("Dispatch Action [%s] detected; Dispatch Actions will be removed in a future version of Grails.", dispatchActionName)); + LOG.warn(String.format("Dispatch Action [%s] detected; Dispatch Actions will be removed in a future version of Grails. Use g: formActionSubmit instead.", dispatchActionName)); } return dispatchActionName;