Browse Source

only try to restore attribute if the value differs (ignoring Portlet spec attributes; SPR-6712)

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@2829 50f2f4bb-b051-0410-bef5-90022cba6387
pull/1/head
Juergen Hoeller 16 years ago
parent
commit
730a3ffaa6
  1. 14
      org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/DispatcherServlet.java

14
org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/DispatcherServlet.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2009 the original author or authors. * Copyright 2002-2010 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -1151,17 +1151,17 @@ public class DispatcherServlet extends FrameworkServlet {
// or removing the attribute, respectively, if appropriate. // or removing the attribute, respectively, if appropriate.
for (String attrName : attrsToCheck) { for (String attrName : attrsToCheck) {
Object attrValue = attributesSnapshot.get(attrName); Object attrValue = attributesSnapshot.get(attrName);
if (attrValue != null) { if (attrValue == null){
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debug("Restoring original value of attribute [" + attrName + "] after include"); logger.debug("Removing attribute [" + attrName + "] after include");
} }
request.setAttribute(attrName, attrValue); request.removeAttribute(attrName);
} }
else { else if (attrValue != request.getAttribute(attrName)) {
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debug("Removing attribute [" + attrName + "] after include"); logger.debug("Restoring original value of attribute [" + attrName + "] after include");
} }
request.removeAttribute(attrName); request.setAttribute(attrName, attrValue);
} }
} }
} }

Loading…
Cancel
Save