From: Juergen H. <jho...@us...> - 2006-04-21 00:13:57
|
Update of /cvsroot/springframework/spring/src/org/springframework/web/servlet/handler In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19629/src/org/springframework/web/servlet/handler Modified Files: Tag: mbranch-1-2 SimpleMappingExceptionResolver.java Log Message: backported fixes and enhancements from 2.0 M4 (HEAD) Index: SimpleMappingExceptionResolver.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/web/servlet/handler/SimpleMappingExceptionResolver.java,v retrieving revision 1.11.2.2 retrieving revision 1.11.2.3 diff -C2 -d -r1.11.2.2 -r1.11.2.3 *** SimpleMappingExceptionResolver.java 23 Feb 2006 22:37:06 -0000 1.11.2.2 --- SimpleMappingExceptionResolver.java 21 Apr 2006 00:13:50 -0000 1.11.2.3 *************** *** 30,33 **** --- 30,34 ---- import org.springframework.web.servlet.HandlerExceptionResolver; import org.springframework.web.servlet.ModelAndView; + import org.springframework.web.util.WebUtils; /** *************** *** 121,129 **** /** ! * Set the default HTTP status code that this exception resolver ! * will apply if it resolves an error view. ! * <p>If not specified, no status code will be applied, either ! * leaving this to the controller or view, or keeping the servlet ! * engine's default of 200 (OK). * @param defaultStatusCode HTTP status code value, for example * 500 (SC_INTERNAL_SERVER_ERROR) or 404 (SC_NOT_FOUND) --- 122,132 ---- /** ! * Set the default HTTP status code that this exception resolver will apply ! * if it resolves an error view. ! * <p>Note that this error code will only get applied in case of a top-level ! * request. It will not be set for an include request, since the HTTP status ! * cannot be modified from within an include. ! * <p>If not specified, no status code will be applied, either leaving this to ! * the controller or view, or keeping the servlet engine's default of 200 (OK). * @param defaultStatusCode HTTP status code value, for example * 500 (SC_INTERNAL_SERVER_ERROR) or 404 (SC_NOT_FOUND) *************** *** 169,173 **** if (viewName != null) { // Apply HTTP status code for error views, if specified. ! if (this.defaultStatusCode != null) { response.setStatus(this.defaultStatusCode.intValue()); } --- 172,177 ---- if (viewName != null) { // Apply HTTP status code for error views, if specified. ! // Only apply it if we're processing a top-level request. ! if (this.defaultStatusCode != null && !WebUtils.isIncludeRequest(request)) { response.setStatus(this.defaultStatusCode.intValue()); } *************** *** 188,191 **** --- 192,196 ---- */ protected String findMatchingViewName(Properties exceptionMappings, Exception ex) { + String viewName = null; int deepest = Integer.MAX_VALUE; for (Enumeration names = this.exceptionMappings.propertyNames(); names.hasMoreElements();) { *************** *** 194,201 **** if (depth >= 0 && depth < deepest) { deepest = depth; ! return this.exceptionMappings.getProperty(exceptionMapping); } } ! return null; } --- 199,206 ---- if (depth >= 0 && depth < deepest) { deepest = depth; ! viewName = this.exceptionMappings.getProperty(exceptionMapping); } } ! return viewName; } |