exception - Handling error 500 by Interceptor in Spring MVC -
i have created interceptor class , have overridden aftercompletion method. when ever system throws error ( 500, 404 ), system breaks , not reach aftercompletion method of interceptor. there way request can reach aftercompletion method exception occured.
interceptor class
public class classname extends handlerinterceptoradapter { @override public void aftercompletion(httpservletrequest request,httpservletresponse response, object handler, exception ex) throws exception { if (ex != null) { //do somthing here } }
}
interceptor declaration
<mvc:interceptors> <bean class="x.y.z.classname" /> </mvc:interceptors>
can guide me 1 this.
i using swf + mvc , realized different ways of registering interceptors ,
<bean class="org.springframework.webflow.mvc.servlet.flowhandlermapping"> <property name="flowregistry" ref="datacollectorflowregistry" /> <property name="interceptors"> <list> <ref bean="localechangeinterceptor"/> </list> </property> </bean>
this works me.
Comments
Post a Comment