Class DelegatingServerHttpResponse
java.lang.Object
org.springframework.http.server.DelegatingServerHttpResponse
- All Implemented Interfaces:
Closeable, Flushable, AutoCloseable, HttpMessage, HttpOutputMessage, ServerHttpResponse
Implementation of
ServerHttpResponse that delegates all calls to a
given target ServerHttpResponse.- Since:
- 5.3.2
- Author:
- Arjen Poutsma
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a newDelegatingServerHttpResponse. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close this response, freeing any resources created.voidflush()Ensure that the headers and the content of the response are written out.getBody()Return the body of the message as an output stream.Returns the target response that this response delegates to.Return the headers of this message.voidsetStatusCode(HttpStatusCode status) Set the HTTP status code of the response.
-
Constructor Details
-
DelegatingServerHttpResponse
Create a newDelegatingServerHttpResponse.- Parameters:
delegate- the response to delegate to
-
-
Method Details
-
getDelegate
Returns the target response that this response delegates to.- Returns:
- the delegate
-
setStatusCode
Description copied from interface:ServerHttpResponseSet the HTTP status code of the response.- Specified by:
setStatusCodein interfaceServerHttpResponse- Parameters:
status- the HTTP status as an HttpStatus enum value
-
flush
Description copied from interface:ServerHttpResponseEnsure that the headers and the content of the response are written out.After the first flush, headers can no longer be changed. Only further content writing and content flushing is possible.
- Specified by:
flushin interfaceFlushable- Specified by:
flushin interfaceServerHttpResponse- Throws:
IOException
-
close
public void close()Description copied from interface:ServerHttpResponseClose this response, freeing any resources created.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceServerHttpResponse
-
getBody
Description copied from interface:HttpOutputMessageReturn the body of the message as an output stream.- Specified by:
getBodyin interfaceHttpOutputMessage- Returns:
- the output stream body (never
null) - Throws:
IOException- in case of I/O errors
-
getHeaders
Description copied from interface:HttpMessageReturn the headers of this message.- Specified by:
getHeadersin interfaceHttpMessage- Returns:
- a corresponding HttpHeaders object (never
null)
-