Why not just delegate the implementation of handleException()
another method?
// superclass protected ModelAndView handleExceptionImpl( NoUserException e, HttpServletResponse response) { Map<String, Object> model = new HashMap<String, Object>(); model.put(ModelKeys.HOST_KEY, "message"); return new ModelAndView("noAccess",model); } @ExceptionHandler(NoUserException.class) protected ModelAndView handleException( NoUserException e, HttpServletResponse response) { return handleExceptionImpl(e, response); } // subclass @Override protected ModelAndView handleExceptionImpl( NoUserException e, HttpServletResponse response) { logger.error("Invalid user."); respond(CLIENT_USER_ERROR,response); }
candu source share