public class MockMvcClientHttpRequestFactory extends Object implements ClientHttpRequestFactory, AsyncClientHttpRequestFactory
ClientHttpRequestFactory
for requests executed via MockMvc
.
As of 5.0 this class also implements
AsyncClientHttpRequestFactory
. However note that
AsyncRestTemplate
and related classes
have been deprecated at the same time.
Constructor and Description |
---|
MockMvcClientHttpRequestFactory(MockMvc mockMvc) |
Modifier and Type | Method and Description |
---|---|
AsyncClientHttpRequest |
createAsyncRequest(URI uri,
HttpMethod method)
Create a new asynchronous
AsyncClientHttpRequest for the specified URI
and HTTP method. |
ClientHttpRequest |
createRequest(URI uri,
HttpMethod httpMethod)
Create a new
ClientHttpRequest for the specified URI and HTTP method. |
public MockMvcClientHttpRequestFactory(MockMvc mockMvc)
public ClientHttpRequest createRequest(URI uri, HttpMethod httpMethod)
ClientHttpRequestFactory
ClientHttpRequest
for the specified URI and HTTP method.
The returned request can be written to, and then executed by calling
ClientHttpRequest.execute()
.
createRequest
in interface ClientHttpRequestFactory
uri
- the URI to create a request forhttpMethod
- the HTTP method to executepublic AsyncClientHttpRequest createAsyncRequest(URI uri, HttpMethod method)
AsyncClientHttpRequestFactory
AsyncClientHttpRequest
for the specified URI
and HTTP method.
The returned request can be written to, and then executed by calling
AsyncClientHttpRequest.executeAsync()
.
createAsyncRequest
in interface AsyncClientHttpRequestFactory
uri
- the URI to create a request formethod
- the HTTP method to execute