类 ServletServerHttpResponse
- java.lang.Object
- org.springframework.http.server.ServletServerHttpResponse
public class ServletServerHttpResponse extends Object implements ServerHttpResponse
ServerHttpResponse
implementation that is based on aHttpServletResponse
.- 从以下版本开始:
- 3.0
- 作者:
- Arjen Poutsma, Rossen Stoyanchev
构造器概要
构造器 构造器 说明 ServletServerHttpResponse(HttpServletResponse servletResponse)
Construct a new instance of the ServletServerHttpResponse based on the givenHttpServletResponse
.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 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 theHttpServletResponse
this object is based on.void
setStatusCode(HttpStatus status)
Set the HTTP status code of the response.
构造器详细资料
ServletServerHttpResponse
public ServletServerHttpResponse(HttpServletResponse servletResponse)
Construct a new instance of the ServletServerHttpResponse based on the givenHttpServletResponse
.- 参数:
servletResponse
- the servlet response
方法详细资料
getServletResponse
public HttpServletResponse getServletResponse()
Return theHttpServletResponse
this object is based on.
setStatusCode
public void setStatusCode(HttpStatus status)
从接口复制的说明:ServerHttpResponse
Set the HTTP status code of the response.- 指定者:
setStatusCode
在接口中ServerHttpResponse
- 参数:
status
- the HTTP status as an HttpStatus enum value
getHeaders
public HttpHeaders getHeaders()
从接口复制的说明:HttpMessage
Return the headers of this message.- 指定者:
getHeaders
在接口中HttpMessage
- 返回:
- a corresponding HttpHeaders object (never
null
)
getBody
public OutputStream getBody() throws IOException
从接口复制的说明:HttpOutputMessage
Return the body of the message as an output stream.- 指定者:
getBody
在接口中HttpOutputMessage
- 返回:
- the output stream body (never
null
) - 抛出:
IOException
- in case of I/O errors
flush
public void flush() throws IOException
从接口复制的说明:ServerHttpResponse
Ensure 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.
- 指定者:
flush
在接口中Flushable
- 指定者:
flush
在接口中ServerHttpResponse
- 抛出:
IOException
close
public void close()
从接口复制的说明:ServerHttpResponse
Close this response, freeing any resources created.- 指定者:
close
在接口中AutoCloseable
- 指定者:
close
在接口中Closeable
- 指定者:
close
在接口中ServerHttpResponse