public class DefaultResponseCreator extends Object implements ResponseCreator
ResponseCreator
with builder-style methods for adding response details.Modifier | Constructor and Description |
---|---|
protected |
DefaultResponseCreator(org.springframework.http.HttpStatus statusCode)
Protected constructor.
|
Modifier and Type | Method and Description |
---|---|
DefaultResponseCreator |
body(byte[] content)
Set the body as a byte array.
|
DefaultResponseCreator |
body(org.springframework.core.io.Resource resource)
Set the body as a
Resource . |
DefaultResponseCreator |
body(String content)
Set the body as a UTF-8 String.
|
DefaultResponseCreator |
contentType(org.springframework.http.MediaType mediaType)
Set the
Content-Type header. |
org.springframework.http.client.ClientHttpResponse |
createResponse(org.springframework.http.client.ClientHttpRequest request)
Create a response for the given request.
|
DefaultResponseCreator |
headers(org.springframework.http.HttpHeaders headers)
Copy all given headers.
|
DefaultResponseCreator |
location(URI location)
Set the
Location header. |
protected DefaultResponseCreator(org.springframework.http.HttpStatus statusCode)
MockRestResponseCreators
.public DefaultResponseCreator body(String content)
public DefaultResponseCreator body(byte[] content)
public DefaultResponseCreator body(org.springframework.core.io.Resource resource)
Resource
.public DefaultResponseCreator contentType(org.springframework.http.MediaType mediaType)
Content-Type
header.public DefaultResponseCreator location(URI location)
Location
header.public DefaultResponseCreator headers(org.springframework.http.HttpHeaders headers)
public org.springframework.http.client.ClientHttpResponse createResponse(@Nullable org.springframework.http.client.ClientHttpRequest request) throws IOException
ResponseCreator
createResponse
in interface ResponseCreator
request
- the requestIOException