Spring MVC 返回处理类

   
返回处理类
ModelAndViewMethodReturnValueHandler
处理返回类型为ModelAndView,如果ModelAndView的view是String类型,则mavContainer.setViewName(viewName); 否则mavContainer.setView(ModelAndView.getView()); 最后mavContainer.addAllAttributes(mav.getModel());

ModelMethodProcessor
处理返回类型为Model,执行 mavContainer.addAllAttributes(((Model) returnValue).asMap());

ViewMethodReturnValueHandler
处理返回类型为View,执行 mavContainer.setView(view);

HttpEntityMethodProcessor
处理返回类型为HttpEntity或ResponseEntity,执行以流的形式写入response

CallableMethodReturnValueHandler
处理返回类型为ViewCallable,执行WebAsyncUtils.getAsyncManager(webRequest).startCallableProcessing(callable, mavContainer);

DeferredResultMethodReturnValueHandler
处理返回类型为DeferredResult,执行ViewCallableWebAsyncUtils.getAsyncManager(webRequest).startDeferredResultProcessing(deferredResult, mavContainer);

AsyncTaskMethodReturnValueHandler
处理返回类型为AsyncTaskMethod,执行WebAsyncUtils.getAsyncManager(webRequest).startCallableProcessing(webAsyncTask, mavContainer);

ModelAttributeMethodProcessor
处理类型为ModelAttribute,执行

RequestResponseBodyMethodProcessor
处理返回类型为ResponseEntity,执行以流的形式写入response

ViewNameMethodReturnValueHandler
处理返回类型为void和String   如果String,设置mavContainer.setViewName(viewName);

MapMethodProcessor
处理返回类型为Map , 执行mavContainer.addAllAttributes((Map) returnValue);

ModelAndViewResolverMethodReturnValueHandler

posted @ 2013-11-06 09:44  benx621  阅读(575)  评论(0编辑  收藏  举报