public class ServletServerHttpResponse extends Object implements ServerHttpResponse
ServerHttpResponse implementation that is based on a HttpServletResponse.| Constructor and Description |
|---|
ServletServerHttpResponse(HttpServletResponse servletResponse)
Construct a new instance of the ServletServerHttpResponse based on the given
HttpServletResponse. |
| 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.
|
HttpHeaders |
getHeaders()
Return the headers of this message.
|
HttpServletResponse |
getServletResponse()
Return the
HttpServletResponse this object is based on. |
void |
setStatusCode(HttpStatus status)
Set the HTTP status code of the response.
|
public ServletServerHttpResponse(HttpServletResponse servletResponse)
HttpServletResponse.servletResponse - the servlet responsepublic HttpServletResponse getServletResponse()
HttpServletResponse this object is based on.public void setStatusCode(HttpStatus status)
ServerHttpResponsesetStatusCode in interface ServerHttpResponsestatus - the HTTP status as an HttpStatus enum valuepublic HttpHeaders getHeaders()
HttpMessagegetHeaders in interface HttpMessagenull)public OutputStream getBody() throws IOException
HttpOutputMessagegetBody in interface HttpOutputMessagenull)IOException - in case of I/O errorspublic void flush()
throws IOException
ServerHttpResponseAfter the first flush, headers can no longer be changed. Only further content writing and content flushing is possible.
flush in interface Flushableflush in interface ServerHttpResponseIOExceptionpublic void close()
ServerHttpResponseclose in interface Closeableclose in interface AutoCloseableclose in interface ServerHttpResponse