Class HttpResponseUtils

java.lang.Object
no.digipost.api.client.internal.http.response.HttpResponseUtils

public final class HttpResponseUtils extends Object
  • Method Details

    • safelyOfferEntityStreamExternally

      public static InputStream safelyOfferEntityStreamExternally(org.apache.http.client.methods.CloseableHttpResponse response, EventLogger eventLogger)
      Do proper resource handling in the case when offering the stream from a http response to a third party. The third party must be expected to do proper resource handling on the received stream, but in the case of any thrown exception when acquiring the stream, the 3rd party has no way of closing the resources of the response, and thus must be handled by the method returning the stream.
      Parameters:
      response - the response to acquire the entity stream from
      Returns:
      the stream containing the entity of the response.
    • responseOk

      public static boolean responseOk(org.apache.http.StatusLine status)
    • resourceAlreadyExists

      public static boolean resourceAlreadyExists(org.apache.http.HttpResponse response)
    • checkResponse

      public static void checkResponse(org.apache.http.HttpResponse response, EventLogger eventLogger)