Skip to content

Commit 5d42a62

Browse files
committed
SPR-8759 Provide methods to add or get status codes in SimpleMappingExceptionResolver as Map<String, Integer>.
1 parent dacfa69 commit 5d42a62

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/handler/SimpleMappingExceptionResolver.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,19 @@ public void setStatusCodes(Properties statusCodes) {
9797
}
9898
}
9999

100+
/**
101+
* An alternative to {@link #setStatusCodes(Properties)} for use with
102+
* Java-based configuration.
103+
*/
104+
public void addStatusCode(String viewName, int statusCode) {
105+
this.statusCodes.put(viewName, statusCode);
106+
}
107+
100108
/**
101109
* Returns the HTTP status codes provided via {@link #setStatusCodes(Properties)}.
102110
* Keys are view names; values are status codes.
103111
*/
104-
public Map<String, Integer> getStatusCodes() {
112+
public Map<String, Integer> getStatusCodesAsMap() {
105113
return Collections.unmodifiableMap(statusCodes);
106114
}
107115

0 commit comments

Comments
 (0)