类 IntrospectingClientHttpResponse

java.lang.Object
cn.taketoday.http.client.ClientHttpResponseDecorator
cn.taketoday.web.client.IntrospectingClientHttpResponse
所有已实现的接口:
ClientHttpResponse, HttpInputMessage, HttpMessage, Closeable, AutoCloseable

class IntrospectingClientHttpResponse extends ClientHttpResponseDecorator implements ClientHttpResponse
Implementation of ClientHttpResponse that can not only check if the response has a message body, but also if its length is 0 (i.e. empty) by actually reading the input stream.
从以下版本开始:
4.0
作者:
Brian Clozel, Harry Yang
另请参阅:
  • 字段详细资料

  • 构造器详细资料

    • IntrospectingClientHttpResponse

      public IntrospectingClientHttpResponse(ClientHttpResponse response)
  • 方法详细资料

    • hasMessageBody

      public boolean hasMessageBody() throws IOException
      Indicates whether the response has a message body.

      Implementation returns false for:

      • a response status of 1XX, 204 or 304
      • a Content-Length header of 0
      返回:
      true if the response has a message body, false otherwise
      抛出:
      IOException - in case of I/O errors
    • hasEmptyMessageBody

      public boolean hasEmptyMessageBody() throws IOException
      Indicates whether the response has an empty message body.

      Implementation tries to read the first bytes of the response stream:

      • if no bytes are available, the message body is empty
      • otherwise it is not empty and the stream is reset to its start for further reading
      返回:
      true if the response has a zero-length message body, false otherwise
      抛出:
      IOException - in case of I/O errors
    • getBody

      public InputStream getBody() throws IOException
      从接口复制的说明: HttpInputMessage
      Return the body of the message as an input stream.
      指定者:
      getBody 在接口中 HttpInputMessage
      覆盖:
      getBody 在类中 ClientHttpResponseDecorator
      返回:
      the input stream body (never null)
      抛出:
      IOException - in case of I/O errors