Package org.springframework.http.server
Class ServletServerHttpResponse
java.lang.Object
org.springframework.http.server.ServletServerHttpResponse
- All Implemented Interfaces:
- Closeable,- Flushable,- AutoCloseable,- HttpMessage,- HttpOutputMessage,- ServerHttpResponse
ServerHttpResponse implementation that is based on a HttpServletResponse.- Since:
- 3.0
- Author:
- Arjen Poutsma, Rossen Stoyanchev
- 
Constructor SummaryConstructorsConstructorDescriptionServletServerHttpResponse(HttpServletResponse servletResponse) Construct a new instance of the ServletServerHttpResponse based on the givenHttpServletResponse.
- 
Method SummaryModifier 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.Return the headers of this message.Return theHttpServletResponsethis object is based on.voidsetStatusCode(HttpStatusCode status) Set the HTTP status code of the response.
- 
Constructor Details- 
ServletServerHttpResponseConstruct a new instance of the ServletServerHttpResponse based on the givenHttpServletResponse.- Parameters:
- servletResponse- the servlet response
 
 
- 
- 
Method Details- 
getServletResponseReturn theHttpServletResponsethis object is based on.
- 
setStatusCodeDescription copied from interface:ServerHttpResponseSet the HTTP status code of the response.- Specified by:
- setStatusCodein interface- ServerHttpResponse
- Parameters:
- status- the HTTP status as an HttpStatus enum value
 
- 
getHeadersDescription copied from interface:HttpMessageReturn the headers of this message.- Specified by:
- getHeadersin interface- HttpMessage
- Returns:
- a corresponding HttpHeaders object (never null)
 
- 
getBodyDescription copied from interface:HttpOutputMessageReturn the body of the message as an output stream.- Specified by:
- getBodyin interface- HttpOutputMessage
- Returns:
- the output stream body (never null)
- Throws:
- IOException- in case of I/O errors
 
- 
flushDescription 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 interface- Flushable
- Specified by:
- flushin interface- ServerHttpResponse
- Throws:
- IOException
 
- 
closepublic void close()Description copied from interface:ServerHttpResponseClose this response, freeing any resources created.- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Specified by:
- closein interface- ServerHttpResponse
 
 
-