021_SpringMVC role in the interceptors?

The main interceptor is to intercept using the controller to directly access dynamic resource files in the web-inf directory.

Because of this we are likely to cause incomplete page loads, such as user name does not appear.

 

intercept execution timing: a processor mapping according to an user requests a post mapping to be executed by a processor-based, and also found the processor is adapted to execute the class, the processor adapted to perform before.

We are the interceptors can be customized, but he wanted to inherit HanderIntercept interface.
Blocker has three methods, preHandler (), PostHandler (), afterComplaint ()
preHandler () just returns true, afterComplaint () had to be implemented.
afterComplaint () on the stack, last-out.
Only preHandeler returns true, the processor can be called back.

 

A schematic view of a single interceptor:

A schematic view of a plurality of interceptors

Guess you like

Origin www.cnblogs.com/pogusanqian/p/12465832.html