Skip to content

Commit cc5d4ca

Browse files
authored
Merge pull request #13905 from jdaugherty/feature/7.0.0/deprecateDispatchAction
Mark dispatch action as deprecated due to grails-gsp#551
2 parents 5fed630 + a1d2263 commit cc5d4ca

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

UPGRADE7.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@ Experienced while upgrading modules for Grails 7
99
- Jar artifacts produced by Grails Plugins will no longer have the suffix `-plain`
1010
- https://github.com/grails/grails-gradle-plugin/pull/347
1111
- [GROOVY-5169](https://issues.apache.org/jira/browse/GROOVY-5169) [GROOVY-10449](https://issues.apache.org/jira/browse/GROOVY-10449)
12-
- Fields with a public modifier were not returned with MetaClassImpl#getProperties() in groovy 3, but are now.
12+
- Fields with a public modifier were not returned with MetaClassImpl#getProperties() in groovy 3, but are now.
1313

1414
## NOTE: This document is a draft and the explanations are only highlights and will be expanded further prior to release of 7.0.
1515

16+
## New Features
17+
- [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.
18+
1619
### Cool New Features
1720
- You can now @Scaffold Controllers and Services and virtually eliminate any boiler plate code.
1821
- Hello Exterminator, Good by bugs! Lot's of things started working... and working well! For instance, use of controller namespaces now work seemlessly.

grails-web-url-mappings/src/main/groovy/org/grails/web/mapping/DefaultUrlMappingInfo.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
import grails.core.GrailsApplication;
3333
import grails.web.mapping.UrlMappingInfo;
3434
import grails.web.mapping.exceptions.UrlMappingException;
35+
import org.apache.commons.logging.Log;
36+
import org.apache.commons.logging.LogFactory;
3537
import org.grails.web.servlet.mvc.GrailsWebRequest;
3638
import org.grails.web.util.WebUtils;
3739
import org.springframework.context.ApplicationContext;
@@ -49,6 +51,7 @@
4951
*/
5052
public class DefaultUrlMappingInfo extends AbstractUrlMappingInfo {
5153

54+
private static final Log LOG = LogFactory.getLog(DefaultUrlMappingInfo.class);
5255
private static final String SETTING_GRAILS_WEB_DISABLE_MULTIPART = "grails.web.disable.multipart";
5356
private static final String CONTROLLER_PREFIX = "controller:";
5457
private static final String ACTION_PREFIX = "action:";
@@ -212,6 +215,13 @@ public String getId() {
212215
return evaluateNameForValue(id);
213216
}
214217

218+
/**
219+
* @deprecated
220+
* This method will be removed in a future grails version since the associated g:submitAction is being removed.
221+
* Grails will no longer support redirecting to a different action name by adding a parameter with the prefix
222+
* '_action'
223+
*/
224+
@Deprecated(since = "7.0.0", forRemoval = true)
215225
private String checkDispatchAction(HttpServletRequest request) {
216226
if (request.getAttribute(WebUtils.EXCEPTION_ATTRIBUTE) != null || WebUtils.isForwardOrInclude(request)) {
217227
return null;
@@ -231,6 +241,11 @@ private String checkDispatchAction(HttpServletRequest request) {
231241
break;
232242
}
233243
}
244+
245+
if (LOG.isWarnEnabled() && dispatchActionName != null) {
246+
LOG.warn(String.format("Dispatch Action [%s] detected; Dispatch Actions will be removed in a future version of Grails. Use g: formActionSubmit instead.", dispatchActionName));
247+
}
248+
234249
return dispatchActionName;
235250
}
236251

0 commit comments

Comments
 (0)