Class HttpResponseUtils
- java.lang.Object
-
- no.digipost.api.client.internal.http.response.HttpResponseUtils
-
public final class HttpResponseUtils extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
checkResponse(org.apache.http.HttpResponse response, EventLogger eventLogger)
static boolean
resourceAlreadyExists(org.apache.http.HttpResponse response)
static boolean
responseOk(org.apache.http.StatusLine status)
static InputStream
safelyOfferEntityStreamExternally(org.apache.http.client.methods.CloseableHttpResponse response, EventLogger eventLogger)
Do proper resource handling in the case when offering thestream
from a http response to a third party.
-
-
-
Method Detail
-
safelyOfferEntityStreamExternally
public static InputStream safelyOfferEntityStreamExternally(org.apache.http.client.methods.CloseableHttpResponse response, EventLogger eventLogger)
Do proper resource handling in the case when offering thestream
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)
-
-