jars
08-19-2004, 10:13 AM
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]
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]