I want to have the following method:
@ExceptionHandler(MyRuntimeException.class)
public String myRuntimeException(MyRuntimeException e, RedirectAttributes redire
You could always forward then redirect (or redirect twice).. First to another request mapping where you have normal access to RedirectAttributes, then again to your final destination.
@ExceptionHandler(Exception.class)
public String handleException(final Exception e) {
return "forward:/n/error";
}
@RequestMapping(value = "/n/error", method = RequestMethod.GET)
public String error(final RedirectAttributes redirectAttributes) {
redirectAttributes.addAttribute("foo", "baz");
return "redirect:/final-destination";
}