Announcement Announcement Module
Collapse
No announcement yet.
How to get the actual view inside Exception Handler? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to get the actual view inside Exception Handler?

    Contnuing the topic "Example of ExceptionHandler"...

    public class ArrayStoreExceptionHandler implements HandlerExceptionResolver, Ordered {
    private int order;

    public ModelAndView resolveException(HttpServletRequest request,
    HttpServletResponse response,
    Object handler,
    Exception e) {
    if (e instanceof ArrayStoreException)

    /* BUT HERE I WANT TO KNOW WHERE THE EXCEPTION WAS TRIGGERED */

    return new ModelAndView("TheViewWhereTheExceptionWasTriggered ");
    else
    return null;
    }

    public int getOrder() {
    return order;
    }

    public void setOrder(int order) {
    this.order = order;
    }
    }

    I resolved creating an interface:
    public interface MyAppAbstractViewController {
    String getViewName();
    }

    and now:

    public class SpringController implements Controller, MyAppAbstractViewController {

    ....

    But i think there must be another better way, someone has any idea?

    Thanks.[/quote]
Working...
X