HttpServletResponse 的构建

viewandmodel中的数据最终序列化后写入response;

没有的话则不做处理mv != null;

 

@RequestMapping("/login")
  public void login(User user, HttpServletResponse response){
    response.getWriter.write(JSONObject.fromObject(user).toString());
  }

 

@Override

public void render(Map model, HttpServletRequest request, HttpServletResponse response)

throws Exception {

response.setContentType(getContentType());

FileCopyUtils.copy(this.resource.getInputStream(), response.getOutputStream());

}

 

processDispatchResult

// Did the handler return a view to render?

if (mv != null && !mv.wasCleared()) {

render(mv, request, response);

if (errorView) {

WebUtils.clearErrorRequestAttributes(request);

}

}

 

render(Map, HttpServletRequest, HttpServletResponse) : void - org.springframework.boot.autoconfigure.web.servlet.error.DefaultErrorViewResolver.HtmlResourceView

render(ModelAndView, HttpServletRequest, HttpServletResponse) : void - org.springframework.web.servlet.DispatcherServlet

processDispatchResult(HttpServletRequest, HttpServletResponse, HandlerExecutionChain, ModelAndView, Exception) : void - org.springframework.web.servlet.DispatcherServlet

render(ModelAndView, HttpServletRequest, HttpServletResponse) : void - org.springframework.test.web.servlet.TestDispatcherServlet

processDispatchResult(HttpServletRequest, HttpServletResponse, HandlerExecutionChain, ModelAndView, Exception) : void - org.springframework.web.servlet.DispatcherServlet

doDispatch(HttpServletRequest, HttpServletResponse) : void - org.springframework.web.servlet.DispatcherServlet

doService(HttpServletRequest, HttpServletResponse) : void - org.springframework.web.servlet.DispatcherServlet

processRequest(HttpServletRequest, HttpServletResponse) : void - org.springframework.web.servlet.FrameworkServlet

 

你可能感兴趣的:(HttpServletResponse 的构建)