public class PrintingResultHandler extends Object implements ResultHandler
MvcResult
details to a given output
stream — for example: System.out
, System.err
, a
custom java.io.PrintWriter
, etc.
An instance of this class is typically accessed via one of the
print
or log
methods in MockMvcResultHandlers
.
Modifier and Type | Class and Description |
---|---|
protected static interface |
PrintingResultHandler.ResultValuePrinter
A contract for how to actually write result information.
|
Modifier | Constructor and Description |
---|---|
protected |
PrintingResultHandler(PrintingResultHandler.ResultValuePrinter printer)
Protected constructor.
|
Modifier and Type | Method and Description |
---|---|
protected MultiValueMap<String,String> |
getParamsMultiValueMap(MockHttpServletRequest request) |
protected PrintingResultHandler.ResultValuePrinter |
getPrinter()
Return the result value printer.
|
protected HttpHeaders |
getRequestHeaders(MockHttpServletRequest request) |
protected HttpHeaders |
getResponseHeaders(MockHttpServletResponse response) |
protected Map<String,Object> |
getSessionAttributes(MockHttpServletRequest request) |
void |
handle(MvcResult result)
Print
MvcResult 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.
|
protected PrintingResultHandler(PrintingResultHandler.ResultValuePrinter printer)
printer
- a PrintingResultHandler.ResultValuePrinter
to do the actual writingprotected PrintingResultHandler.ResultValuePrinter getPrinter()
public final void handle(MvcResult result) throws Exception
MvcResult
details.handle
in interface ResultHandler
result
- the result of the executed requestException
- if a failure occursprotected void printRequest(MockHttpServletRequest request) throws Exception
Exception
protected final HttpHeaders getRequestHeaders(MockHttpServletRequest request)
protected final MultiValueMap<String,String> getParamsMultiValueMap(MockHttpServletRequest request)
protected final Map<String,Object> getSessionAttributes(MockHttpServletRequest request)
protected void printAsyncResult(MvcResult result) throws Exception
Exception
protected void printHandler(@Nullable Object handler, @Nullable HandlerInterceptor[] interceptors) throws Exception
Exception
protected void printResolvedException(@Nullable Exception resolvedException) throws Exception
Exception
protected void printModelAndView(@Nullable ModelAndView mav) throws Exception
Exception
protected void printFlashMap(FlashMap flashMap) throws Exception
Exception
protected void printResponse(MockHttpServletResponse response) throws Exception
Exception
protected final HttpHeaders getResponseHeaders(MockHttpServletResponse response)