public class PrintingResultHandler extends java.lang.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 org.springframework.util.MultiValueMap<java.lang.String,java.lang.String> |
getParamsMultiValueMap(MockHttpServletRequest request) |
protected PrintingResultHandler.ResultValuePrinter |
getPrinter()
Return the result value printer.
|
protected org.springframework.http.HttpHeaders |
getRequestHeaders(MockHttpServletRequest request) |
protected org.springframework.http.HttpHeaders |
getResponseHeaders(MockHttpServletResponse response) |
protected java.util.Map<java.lang.String,java.lang.Object> |
getSessionAttributes(MockHttpServletRequest request) |
void |
handle(MvcResult result)
Print
MvcResult details. |
protected void |
printAsyncResult(MvcResult result) |
protected void |
printFlashMap(org.springframework.web.servlet.FlashMap flashMap)
Print "output" flash attributes.
|
protected void |
printHandler(java.lang.Object handler,
org.springframework.web.servlet.HandlerInterceptor[] interceptors)
Print the handler.
|
protected void |
printModelAndView(org.springframework.web.servlet.ModelAndView mav)
Print the ModelAndView.
|
protected void |
printRequest(MockHttpServletRequest request)
Print the request.
|
protected void |
printResolvedException(java.lang.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 java.lang.Exception
MvcResult
details.handle
in interface ResultHandler
result
- the result of the executed requestjava.lang.Exception
- if a failure occursprotected void printRequest(MockHttpServletRequest request) throws java.lang.Exception
java.lang.Exception
protected final org.springframework.http.HttpHeaders getRequestHeaders(MockHttpServletRequest request)
protected final org.springframework.util.MultiValueMap<java.lang.String,java.lang.String> getParamsMultiValueMap(MockHttpServletRequest request)
protected final java.util.Map<java.lang.String,java.lang.Object> getSessionAttributes(MockHttpServletRequest request)
protected void printAsyncResult(MvcResult result) throws java.lang.Exception
java.lang.Exception
protected void printHandler(@Nullable java.lang.Object handler, @Nullable org.springframework.web.servlet.HandlerInterceptor[] interceptors) throws java.lang.Exception
java.lang.Exception
protected void printResolvedException(@Nullable java.lang.Exception resolvedException) throws java.lang.Exception
java.lang.Exception
protected void printModelAndView(@Nullable org.springframework.web.servlet.ModelAndView mav) throws java.lang.Exception
java.lang.Exception
protected void printFlashMap(org.springframework.web.servlet.FlashMap flashMap) throws java.lang.Exception
java.lang.Exception
protected void printResponse(MockHttpServletResponse response) throws java.lang.Exception
java.lang.Exception
protected final org.springframework.http.HttpHeaders getResponseHeaders(MockHttpServletResponse response)