类 ServletServerHttpResponse
- java.lang.Object
- org.springframework.http.server.ServletServerHttpResponse
public class ServletServerHttpResponse extends Object implements ServerHttpResponse
ServerHttpResponseimplementation 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.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 voidclose()Close this response, freeing any resources created.voidflush()Ensure that the headers and the content of the response are written out.OutputStreamgetBody()Return the body of the message as an output stream.HttpHeadersgetHeaders()Return the headers of this message.HttpServletResponsegetServletResponse()Return theHttpServletResponsethis object is based on.voidsetStatusCode(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 theHttpServletResponsethis object is based on.
setStatusCode
public void setStatusCode(HttpStatus status)
从接口复制的说明:ServerHttpResponseSet the HTTP status code of the response.- 指定者:
setStatusCode在接口中ServerHttpResponse- 参数:
status- the HTTP status as an HttpStatus enum value
getHeaders
public HttpHeaders getHeaders()
从接口复制的说明:HttpMessageReturn the headers of this message.- 指定者:
getHeaders在接口中HttpMessage- 返回:
- a corresponding HttpHeaders object (never
null)
getBody
public OutputStream getBody() throws IOException
从接口复制的说明:HttpOutputMessageReturn 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
从接口复制的说明: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.
- 指定者:
flush在接口中Flushable- 指定者:
flush在接口中ServerHttpResponse- 抛出:
IOException
close
public void close()
从接口复制的说明:ServerHttpResponseClose this response, freeing any resources created.- 指定者:
close在接口中AutoCloseable- 指定者:
close在接口中Closeable- 指定者:
close在接口中ServerHttpResponse