org.springframework.test.web.servlet.result

## Class PrintingResultHandler

- java.lang.Object
- - org.springframework.test.web.servlet.result.PrintingResultHandler

All Implemented Interfaces:
  ResultHandler

    public class PrintingResultHandler
    extends Object
    implements ResultHandler

Result handler that prints `MvcResult` details to the "standard" output stream. An instance of this class is typically accessed via `MockMvcResultHandlers.print()`.

Since:
  3.2
Author:
  Rossen Stoyanchev

### Nested Class Summary

Nested Classes
`protected static interface` `PrintingResultHandler.ResultValuePrinter` A contract for how to actually write result information.

### Constructor Summary

Constructors
`protected` `PrintingResultHandler(PrintingResultHandler.ResultValuePrinter printer)` Protected constructor.

### Method Summary

Methods
`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)` Print `MvcResult` details to the "standard" output stream.
`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

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### PrintingResultHandler

    protected PrintingResultHandler(PrintingResultHandler.ResultValuePrinter printer)

Protected constructor.

Parameters:
  `printer` - a `PrintingResultHandler.ResultValuePrinter` to do the actual writing

### Method Detail

#### getPrinter

    protected PrintingResultHandler.ResultValuePrinter getPrinter()

Returns:
  the result value printer.

#### handle

    public final void handle(MvcResult result)
                      throws Exception

Print `MvcResult` details to the "standard" output stream.

Specified by:
  `handle` in interface `ResultHandler`
Parameters:
  `result` - the result of the executed request
Throws:
  `Exception` - if a failure occurs

#### printRequest

    protected void printRequest(MockHttpServletRequest request)
                         throws Exception

Print the request

Throws:
  `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

Throws:
  `Exception`

#### printHandler

    protected void printHandler(Object handler,
                    HandlerInterceptor[] interceptors)
                         throws Exception

Print the handler

Throws:
  `Exception`

#### printResolvedException

    protected void printResolvedException(Exception resolvedException)
                                   throws Exception

Print exceptions resolved through a HandlerExceptionResolver

Throws:
  `Exception`

#### printModelAndView

    protected void printModelAndView(ModelAndView mav)
                              throws Exception

Print the ModelAndView

Throws:
  `Exception`

#### printFlashMap

    protected void printFlashMap(FlashMap flashMap)
                          throws Exception

Print "output" flash attributes

Throws:
  `Exception`

#### printResponse

    protected void printResponse(MockHttpServletResponse response)
                          throws Exception

Print the response

Throws:
  `Exception`

#### getResponseHeaders

    protected final HttpHeaders getResponseHeaders(MockHttpServletResponse response)