类 PrintingResultHandler
- java.lang.Object
- org.springframework.test.web.servlet.result.PrintingResultHandler
- 所有已实现的接口:
ResultHandler
public class PrintingResultHandler extends Object implements ResultHandler
Result handler that printsMvcResult
details 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
print
orlog
methods inMockMvcResultHandlers
.- 从以下版本开始:
- 3.2
- 作者:
- Rossen Stoyanchev, Sam Brannen
嵌套类概要
嵌套类 修饰符和类型 类 说明 protected static interface
PrintingResultHandler.ResultValuePrinter
A contract for how to actually write result information.
构造器概要
构造器 限定符 构造器 说明 protected
PrintingResultHandler(PrintingResultHandler.ResultValuePrinter printer)
Protected constructor.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 protected MultiValueMap<String,String>
getParamsMultiValueMap(MockHttpServletRequest request)
protected PrintingResultHandler.ResultValuePrinter
getPrinter()
protected HttpHeaders
getRequestHeaders(MockHttpServletRequest request)
protected HttpHeaders
getResponseHeaders(MockHttpServletResponse response)
void
handle(MvcResult result)
PrintMvcResult
details.protected void
printAsyncResult(MvcResult result)
protected void
printFlashMap(FlashMap flashMap)
Print "output" flash attributes.protected void
printHandler(Object handler, HandlerInterceptor[] interceptors)
Print the handler.protected void
printModelAndView(ModelAndView mav)
Print the ModelAndView.protected void
printRequest(MockHttpServletRequest request)
Print the request.protected void
printResolvedException(Exception resolvedException)
Print exceptions resolved through a HandlerExceptionResolver.protected void
printResponse(MockHttpServletResponse response)
Print the response.
构造器详细资料
PrintingResultHandler
protected PrintingResultHandler(PrintingResultHandler.ResultValuePrinter printer)
Protected constructor.- 参数:
printer
- aPrintingResultHandler.ResultValuePrinter
to do the actual writing
方法详细资料
getPrinter
protected PrintingResultHandler.ResultValuePrinter getPrinter()
- 返回:
- the result value printer
handle
public final void handle(MvcResult result) throws Exception
PrintMvcResult
details.- 指定者:
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)