类 PrintingResultHandler
- java.lang.Object
- org.springframework.test.web.servlet.result.PrintingResultHandler
- 所有已实现的接口:
ResultHandler
public class PrintingResultHandler extends Object implements ResultHandler
Result handler that printsMvcResultdetails to a given output stream — for example:System.out,System.err, a customjava.io.PrintWriter, etc.An instance of this class is typically accessed via one of the
printorlogmethods inMockMvcResultHandlers.- 从以下版本开始:
- 3.2
- 作者:
- Rossen Stoyanchev, Sam Brannen
嵌套类概要
嵌套类 修饰符和类型 类 说明 protected static interfacePrintingResultHandler.ResultValuePrinterA contract for how to actually write result information.
构造器概要
构造器 限定符 构造器 说明 protectedPrintingResultHandler(PrintingResultHandler.ResultValuePrinter printer)Protected constructor.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 protected MultiValueMap<String,String>getParamsMultiValueMap(MockHttpServletRequest request)protected PrintingResultHandler.ResultValuePrintergetPrinter()protected HttpHeadersgetRequestHeaders(MockHttpServletRequest request)protected HttpHeadersgetResponseHeaders(MockHttpServletResponse response)voidhandle(MvcResult result)PrintMvcResultdetails.protected voidprintAsyncResult(MvcResult result)protected voidprintFlashMap(FlashMap flashMap)Print "output" flash attributes.protected voidprintHandler(Object handler, HandlerInterceptor[] interceptors)Print the handler.protected voidprintModelAndView(ModelAndView mav)Print the ModelAndView.protected voidprintRequest(MockHttpServletRequest request)Print the request.protected voidprintResolvedException(Exception resolvedException)Print exceptions resolved through a HandlerExceptionResolver.protected voidprintResponse(MockHttpServletResponse response)Print the response.
构造器详细资料
PrintingResultHandler
protected PrintingResultHandler(PrintingResultHandler.ResultValuePrinter printer)
Protected constructor.- 参数:
printer- aPrintingResultHandler.ResultValuePrinterto do the actual writing
方法详细资料
getPrinter
protected PrintingResultHandler.ResultValuePrinter getPrinter()
- 返回:
- the result value printer
handle
public final void handle(MvcResult result) throws Exception
PrintMvcResultdetails.- 指定者:
handle在接口中ResultHandler- 参数:
result- the result of the executed request- 抛出:
Exception- if a failure occurs
printRequest
protected void printRequest(MockHttpServletRequest request) throws Exception
Print the request.- 抛出:
Exception
getRequestHeaders
protected final HttpHeaders getRequestHeaders(MockHttpServletRequest request)
getParamsMultiValueMap
protected final MultiValueMap<String,String> getParamsMultiValueMap(MockHttpServletRequest request)
printAsyncResult
protected void printAsyncResult(MvcResult result) throws Exception
- 抛出:
Exception
printHandler
protected void printHandler(Object handler, HandlerInterceptor[] interceptors) throws Exception
Print the handler.- 抛出:
Exception
printResolvedException
protected void printResolvedException(Exception resolvedException) throws Exception
Print exceptions resolved through a HandlerExceptionResolver.- 抛出:
Exception
printModelAndView
protected void printModelAndView(ModelAndView mav) throws Exception
Print the ModelAndView.- 抛出:
Exception
printFlashMap
protected void printFlashMap(FlashMap flashMap) throws Exception
Print "output" flash attributes.- 抛出:
Exception
printResponse
protected void printResponse(MockHttpServletResponse response) throws Exception
Print the response.- 抛出:
Exception
getResponseHeaders
protected final HttpHeaders getResponseHeaders(MockHttpServletResponse response)