요청 - Filter - Dispatcher Servlet - Interceptor - Controller
전처리 preHandle
후처리 postHandle
<!-- interceptors : 인터셉터를 모아둔 태그 -->
<interceptors>
<!-- interceptor : 요청이 Dispatcher Servlet에서 Controller에 도달하기 전 또는 후에
요청/응답 객체(req, resp)를 가로채서 사용할 수 있는 객체 -->
<interceptor>
<!-- 가로챌 요청의 패턴을 지정 -->
<mapping path="/**"/>
<!-- 인터셉터 역할을 수행할 클래스를 찾아서 bean 등록 -->
<beans:bean id="boardTypeInterceptor" class="edu.kh.comm.common.interceptor.BoardTypeInterceptor"/>
</interceptor>
</interceptors>
인터셉터가 요청을 가로채는 시기
- preHandle (전처리) : 컨트롤러 수행 전
- postHandler (후처리) : 컨트롤러 수행 후 (컨트롤러 수행 결과 참조 가능)
- afterCompletion (View 단 처리 후) : 보통은 자원 반환(close())을 수행
** 단, 비동기 요청(자바 내부의 별도 쓰레드 요청)은 가로채지 않음
edu.kh.comm.common.interceptor
BoardTypeInterceptor
HandlerInterceptor 상속 받기(오버라이드 메소드)
typeAliases, mappers 추가