본문 바로가기

JAVA/Spring Framework

handlerAdapter - DispatcherServlet

728x90

 

 

 

DispatcherServlet은 HandlerMapping이 찾아 준 컨트롤러 객체를 처리할 수 있는 HandlerAdapter 빈에게 요청 처리를 위임한다.(3)
HandlerAdapter는 @Controller, Controller 인터페이스, HttpRequestHandler 인터페이스를 동일한 방식으로 처리하기 위해 사용된다.

HandlerAdapter는 컨트롤러의 알맞은 메서드를 호출해서 요청을 처리하고(4, 5) 그 결과를 DispatcherServlet에 리턴한다.(6) 이때, HandlerAdapter는 컨트롤러의 처리 결과를 ModelAndView라는 객체로 변환해서 DispatcherServlet에 리턴한다.