public class DelegatingServerHttpResponse extends Object implements ServerHttpResponse
ServerHttpResponse
that delegates all calls to a
given target ServerHttpResponse
.Constructor and Description |
---|
DelegatingServerHttpResponse(ServerHttpResponse delegate)
Create a new
DelegatingServerHttpResponse . |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close this response, freeing any resources created.
|
void |
flush()
Ensure that the headers and the content of the response are written out.
|
OutputStream |
getBody()
Return the body of the message as an output stream.
|
ServerHttpResponse |
getDelegate()
Returns the target response that this response delegates to.
|
HttpHeaders |
getHeaders()
Return the headers of this message.
|
void |
setStatusCode(HttpStatus status)
Set the HTTP status code of the response.
|
public DelegatingServerHttpResponse(ServerHttpResponse delegate)
DelegatingServerHttpResponse
.delegate
- the response to delegate topublic ServerHttpResponse getDelegate()
public void setStatusCode(HttpStatus status)
ServerHttpResponse
setStatusCode
in interface ServerHttpResponse
status
- the HTTP status as an HttpStatus enum valuepublic void flush() throws IOException
ServerHttpResponse
After the first flush, headers can no longer be changed. Only further content writing and content flushing is possible.
flush
in interface Flushable
flush
in interface ServerHttpResponse
IOException
public void close()
ServerHttpResponse
close
in interface Closeable
close
in interface AutoCloseable
close
in interface ServerHttpResponse
public OutputStream getBody() throws IOException
HttpOutputMessage
getBody
in interface HttpOutputMessage
null
)IOException
- in case of I/O errorspublic HttpHeaders getHeaders()
HttpMessage
getHeaders
in interface HttpMessage
null
)