From 0fb4b747c2f634ebcbbc2f4e37726234100e8367 Mon Sep 17 00:00:00 2001 From: Rossen Stoyanchev Date: Mon, 11 Mar 2013 10:32:15 -0400 Subject: [PATCH] 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 --- .../org/springframework/web/servlet/DispatcherServlet.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/DispatcherServlet.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/DispatcherServlet.java index 6483616edb..0a2b40ca4c 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/DispatcherServlet.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/DispatcherServlet.java @@ -1268,6 +1268,7 @@ public class DispatcherServlet extends FrameworkServlet { * @param request current HTTP request * @param attributesSnapshot the snapshot of the request attributes before the include */ + @SuppressWarnings("unchecked") private void restoreAttributesAfterInclude(HttpServletRequest request, Map attributesSnapshot) { logger.debug("Restoring snapshot of request attributes after include"); @@ -1282,6 +1283,9 @@ public class DispatcherServlet extends FrameworkServlet { } } + // Add attributes that may have been removed + attrsToCheck.addAll((Set) attributesSnapshot.keySet()); + // Iterate over the attributes to check, restoring the original value // or removing the attribute, respectively, if appropriate. for (String attrName : attrsToCheck) {