Class OpsViewManager.CloseableClientResponse

java.lang.Object
ecmwf.common.opsview.OpsViewManager.CloseableClientResponse
All Implemented Interfaces:
Closeable, AutoCloseable
Enclosing class:
OpsViewManager

public static class OpsViewManager.CloseableClientResponse extends Object implements Closeable
A wrapper around HttpResponse that implements Closeable.
  • Constructor Details

    • CloseableClientResponse

      public CloseableClientResponse(HttpResponse<String> response)
      Constructs a new CloseableClientResponse wrapping the given response.
      Parameters:
      response - the response to wrap; must not be null
  • Method Details

    • getStatusCode

      public int getStatusCode()
      Returns the HTTP status code of the response.
      Returns:
      the HTTP status code
    • getMessage

      public String getMessage()
      Returns the HTTP status message of the response.
      Returns:
      the status message
    • getEntity

      public <T> T getEntity(Class<T> t) throws IOException
      Reads and returns the entity from the response.
      Type Parameters:
      T - the type of the entity
      Parameters:
      t - the class of the entity
      Returns:
      the entity deserialized as the given class
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • close

      public void close()
      Closes the response.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable