jdaugherty commented on code in PR #14092:
URL: https://github.com/apache/grails-core/pull/14092#discussion_r2019794065
##########
grails-web-url-mappings/src/main/groovy/grails/web/mapping/ResponseRedirector.groovy:
##########
@@ -39,6 +39,7 @@ class ResponseRedirector {
public static final String ARGUMENT_PERMANENT = "permanent"
public static final String ARGUMENT_ABSOLUTE = "absolute"
+ public static final String ARGUMENT_TEMPORARY = "temporary" // Add new
constant
Review Comment:
Drop the comment to be consistent with the current code
##########
grails-web-url-mappings/src/main/groovy/grails/web/mapping/ResponseRedirector.groovy:
##########
@@ -126,7 +127,15 @@ class ResponseRedirector {
}
String redirectUrl = useJessionId ?
response.encodeRedirectURL(redirectURI) : redirectURI
- int status = permanent ? HttpServletResponse.SC_MOVED_PERMANENTLY :
HttpServletResponse.SC_MOVED_TEMPORARILY
+
+ // Update to use arguments instead of request attributes
+ boolean temporary = Boolean.TRUE == arguments.get(ARGUMENT_TEMPORARY)
+ int status
+ if (permanent) {
+ status = temporary ? HttpServletResponse.SC_PERMANENT_REDIRECT :
HttpServletResponse.SC_MOVED_PERMANENTLY
Review Comment:
Instead of the name temporary, wouldn't 'moved' be a better name?
##########
grails-web-url-mappings/src/main/groovy/grails/web/mapping/ResponseRedirector.groovy:
##########
@@ -104,13 +105,13 @@ class ResponseRedirector {
namedParameters.put(LinkGenerator.ATTRIBUTE_PARAMS,
configuredParams + webRequest.originalParams)
}
}
- redirectResponse(linkGenerator.getServerBaseURL(),
linkGenerator.link(namedParameters), request, response, permanent, absolute)
+ redirectResponse(linkGenerator.getServerBaseURL(),
linkGenerator.link(namedParameters), request, response, permanent, absolute,
arguments)
Review Comment:
Lets match the existing style here and not pass the map?
##########
grails-web-url-mappings/src/main/groovy/grails/web/mapping/ResponseRedirector.groovy:
##########
@@ -126,7 +127,15 @@ class ResponseRedirector {
}
String redirectUrl = useJessionId ?
response.encodeRedirectURL(redirectURI) : redirectURI
- int status = permanent ? HttpServletResponse.SC_MOVED_PERMANENTLY :
HttpServletResponse.SC_MOVED_TEMPORARILY
+
+ // Update to use arguments instead of request attributes
+ boolean temporary = Boolean.TRUE == arguments.get(ARGUMENT_TEMPORARY)
Review Comment:
This map be a string value (like permanent). Can you please parse this in
the prior method to be consistent and handle the same edge cases as permanent.
--
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]