Package org.springframework.test.web.servlet

# Interface MvcResult

public interface MvcResult
Provides access to the result of an executed request.

Since:
  3.2
Author:
  Rossen Stoyanchev

## Method Summary

Modifier and Type
Method
Description
`Object`
`getAsyncResult()`
Get the result of async execution.
`Object`
`getAsyncResult(long timeToWait)`
Get the result of async execution and wait if necessary.
`org.springframework.web.servlet.FlashMap`
`getFlashMap()`
Return the "output" flash attributes saved during request processing.
`Object`
`getHandler()`
Return the executed handler.
`org.springframework.web.servlet.HandlerInterceptor[]`
`getInterceptors()`
Return interceptors around the handler.
`org.springframework.web.servlet.ModelAndView`
`getModelAndView()`
Return the `ModelAndView` prepared by the handler.
`MockHttpServletRequest`
`getRequest()`
Return the performed request.
`Exception`
`getResolvedException()`
Return any exception raised by a handler and successfully resolved through a `HandlerExceptionResolver`.
`MockHttpServletResponse`
`getResponse()`
Return the resulting response.

## Method Details

### getRequest

MockHttpServletRequest getRequest()
Return the performed request.

Returns:
  the request (never `null`)

### getResponse

MockHttpServletResponse getResponse()
Return the resulting response.

Returns:
  the response (never `null`)

### getHandler

@Nullable Object getHandler()
Return the executed handler.

Returns:
  the handler, possibly `null` if none were executed

### getInterceptors

@Nullable org.springframework.web.servlet.HandlerInterceptor[] getInterceptors()
Return interceptors around the handler.

Returns:
  interceptors, or `null` if none were selected

### getModelAndView

@Nullable org.springframework.web.servlet.ModelAndView getModelAndView()
Return the `ModelAndView` prepared by the handler.

Returns:
  a `ModelAndView`, or `null` if none

### getResolvedException

@Nullable Exception getResolvedException()
Return any exception raised by a handler and successfully resolved through a `HandlerExceptionResolver`.

Returns:
  an exception, or `null` if none

### getFlashMap

org.springframework.web.servlet.FlashMap getFlashMap()
Return the "output" flash attributes saved during request processing.

Returns:
  the `FlashMap`, possibly empty

### getAsyncResult

Object getAsyncResult()
Get the result of async execution.

This method will wait for the async result to be set within the timeout value associated with the async request, see `MockAsyncContext#setTimeout`. Alternatively, use `getAsyncResult(long)` to specify the amount of time to wait.

Throws:
  `IllegalStateException` - if the async result was not set

### getAsyncResult

Object getAsyncResult(long timeToWait)
Get the result of async execution and wait if necessary.

Parameters:
  `timeToWait` - how long to wait for the async result to be set, in milliseconds; if -1, then fall back on the timeout value associated with the async request, see `MockAsyncContext#setTimeout` for more details.
Throws:
  `IllegalStateException` - if the async result was not set