Filters, interceptors and listeners difference

Filters Uses: used to set the character encoding, URL-level access control, sensitive words filtered
interceptor use: the user is not logged interception, interception and filter functions similar to
the listener uses: listener listens main event of the occurrence of the corresponding . There are ServletContext, ServletRequest object creation and destruction, increase, httpSession attributes, delete, binding settlement of objects tied HTTPSession

: Filters exist relies web container disposed in web.xml, will be called after the request has not yet entered before the servlet or servlet

interceptor (generally refers HandlerInterceptor from): interceptors dependent frame web (spring, Struts) , in the web of the frame profile configuration, after the request to enter the call before and into the corresponding servlet controller, before or after the call controller and the servlet.

Listener: web container dependent on the presence of the configuration in web.xml, called when the event is triggered

Filter interceptor execution order:

(Spring in the interceptor is divided into: HandlerInterceptor and MethodInterceptor see)

Guess you like

Origin www.cnblogs.com/feibazhf/p/11265145.html
Recommended