Skip to content

Commit 0fb4b74

Browse files
committed
Fix issue with restoring included attributes
Before this change the DispatcherServlet restored modified and also removed added attributes but did not restore removed attributes. Issue: SPR-10360
1 parent e9f7445 commit 0fb4b74

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

spring-webmvc/src/main/java/org/springframework/web/servlet/DispatcherServlet.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,6 +1268,7 @@ private void triggerAfterCompletionWithError(HttpServletRequest request, HttpSer
12681268
* @param request current HTTP request
12691269
* @param attributesSnapshot the snapshot of the request attributes before the include
12701270
*/
1271+
@SuppressWarnings("unchecked")
12711272
private void restoreAttributesAfterInclude(HttpServletRequest request, Map<?,?> attributesSnapshot) {
12721273
logger.debug("Restoring snapshot of request attributes after include");
12731274

@@ -1282,6 +1283,9 @@ private void restoreAttributesAfterInclude(HttpServletRequest request, Map<?,?>
12821283
}
12831284
}
12841285

1286+
// Add attributes that may have been removed
1287+
attrsToCheck.addAll((Set<String>) attributesSnapshot.keySet());
1288+
12851289
// Iterate over the attributes to check, restoring the original value
12861290
// or removing the attribute, respectively, if appropriate.
12871291
for (String attrName : attrsToCheck) {

0 commit comments

Comments
 (0)