Class RestResponse

java.lang.Object
com.cloudera.cdp.client.BaseResponse
com.cloudera.cdp.client.RestResponse
All Implemented Interfaces:
AutoCloseable

public class RestResponse extends BaseResponse implements AutoCloseable
  • Constructor Details

    • RestResponse

      public RestResponse()
  • Method Details

    • getStatusInfo

      public javax.ws.rs.core.Response.StatusType getStatusInfo()
      Get the complete status information associated with the response.
      Returns:
      the response status information. The returned value is never null.
    • getEntity

      public Object getEntity()
      Get the message entity Java instance. Returns null if the message does not contain an entity body. If the entity is represented by an un-consumed input stream the method will return the input stream.
      Returns:
      the message entity or null if message does not contain an entity body (i.e. when hasEntity() returns false).
      See Also:
      • Response.getEntity()
    • readEntity

      public <T> T readEntity(Class<T> entityType)
      Read the message entity input stream as an instance of specified Java type.
      Type Parameters:
      T - entity instance Java type.
      Parameters:
      entityType - the type of entity.
      Returns:
      the message entity.
      See Also:
      • Response.readEntity(Class)
    • readEntity

      public <T> T readEntity(Class<T> entityType, Annotation[] annotations)
      Read the message entity input stream as an instance of specified Java type.
      Type Parameters:
      T - entity instance Java type.
      Parameters:
      entityType - the type of entity.
      annotations - annotations that will be passed to the MessageBodyReader.
      Returns:
      the message entity.
      See Also:
      • Response.readEntity(Class, Annotation[])
    • hasEntity

      public boolean hasEntity()
      Check if there is an entity available in the response. The method returns true if the entity is present, returns false otherwise.
      Returns:
      true if there is an entity present in the message, false otherwise.
      See Also:
      • Response.hasEntity()
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable