Class MockMvcClientHttpRequestFactory
- java.lang.Object
- org.springframework.test.web.client.MockMvcClientHttpRequestFactory
- All Implemented Interfaces:
AsyncClientHttpRequestFactory
,ClientHttpRequestFactory
public class MockMvcClientHttpRequestFactory extends Object implements ClientHttpRequestFactory, AsyncClientHttpRequestFactory
AClientHttpRequestFactory
for requests executed viaMockMvc
.As of 5.0 this class also implements
AsyncClientHttpRequestFactory
. However note thatAsyncRestTemplate
and related classes have been deprecated at the same time.- Since:
- 3.2
- Author:
- Rossen Stoyanchev
Constructor Summary
Constructors Constructor Description MockMvcClientHttpRequestFactory(MockMvc mockMvc)
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AsyncClientHttpRequest
createAsyncRequest(URI uri, HttpMethod method)
Create a new asynchronousAsyncClientHttpRequest
for the specified URI and HTTP method.ClientHttpRequest
createRequest(URI uri, HttpMethod httpMethod)
Create a newClientHttpRequest
for the specified URI and HTTP method.
Constructor Detail
MockMvcClientHttpRequestFactory
public MockMvcClientHttpRequestFactory(MockMvc mockMvc)
Method Detail
createRequest
public ClientHttpRequest createRequest(URI uri, HttpMethod httpMethod)
Description copied from interface:ClientHttpRequestFactory
Create a newClientHttpRequest
for the specified URI and HTTP method.The returned request can be written to, and then executed by calling
ClientHttpRequest.execute()
.- Specified by:
createRequest
in interfaceClientHttpRequestFactory
- Parameters:
uri
- the URI to create a request forhttpMethod
- the HTTP method to execute- Returns:
- the created request
createAsyncRequest
public AsyncClientHttpRequest createAsyncRequest(URI uri, HttpMethod method)
Description copied from interface:AsyncClientHttpRequestFactory
Create a new asynchronousAsyncClientHttpRequest
for the specified URI and HTTP method.The returned request can be written to, and then executed by calling
AsyncClientHttpRequest.executeAsync()
.- Specified by:
createAsyncRequest
in interfaceAsyncClientHttpRequestFactory
- Parameters:
uri
- the URI to create a request formethod
- the HTTP method to execute- Returns:
- the created request