+ /**
+ * @
+ * @see #addErrorMapping(HttpStatus, String)
+ */
+ public String addErrorMapping(Integer status, String viewName)
+ {
+ if (status == null)
+ throw new IllegalArgumentException("The status must not be null");
+ return addErrorMapping(HttpStatus.valueOf(status), viewName);
+ }
+
+ /**
+ * Adds a mapping from a {@link HttpStatus} to a view.
+ *
+ * @param status The {@link HttpStatus}, that should be mapped.
+ * @param viewName The name of the view, the status should be mapped to.
+ * @return The name of the view, the status was previously mapped to, or
+ * <code>null</code>, if the status was not mapped before.
+ */
+ public String addErrorMapping(HttpStatus status, String viewName)
+ {
+ if (!StringUtils.hasText(viewName))
+ throw new IllegalArgumentException("The view-name must not be empty!");
+ if (status == null)
+ throw new IllegalArgumentException("The status must not be null!");
+ return errorMappings.put(status, viewName);
+ }
+
+ /**
+ * Sets mappings from {@link HttpStatus} to specialized error-views.
+ * @param mappings The mappings to set.
+ */
+ public void setErrorMappings(Map<HttpStatus, String> mappings)
+ {
+ errorMappings = mappings;
+ }
+
+ /**
+ * Sets the default error-view for not-mapped status-codes.
+ * @param view The default error-view to set.
+ */
+ public void setDefaultErrorView(String view)
+ {
+ defaultErrorView = view;
+ }
+