Spring interceptor works before or after a controller called.
- Usage : Login check, common validation check, set up uri parameter
- todo: implement prehandle(), postHandle(), or AfterCompletion() method
<handler calls in order>
- before controller called : preHandle() works
- after controller called: postHandle() works
- After view made : afterCompletion() works
|
- xml file
<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> <propery name="interceptors"> <list> <ref bean="interceptor1"/> <ref bean="interceptor2"/>
</list> </property> </bean>
|
- Specific handler Calls in order
- interceptor1.preHandle()
interceptor2.preHandle()
- handleRequest() at Controller
- postHandler() works
- interceptor2.postHandle()
- interceptor1.postHandle()
- render() at View Object called and makes the result for response
- afterCompletion() works
- interceptor2.afterCompletion()
- interceptor1.afterCompletion()
|
reference: 최범균 - 웹개발자를 위한 Spring3.0 프로그래밍
댓글 없음:
댓글 쓰기