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 voidcheckResponse(org.apache.http.HttpResponse response, EventLogger eventLogger)static booleanresourceAlreadyExists(org.apache.http.HttpResponse response)static booleanresponseOk(org.apache.http.StatusLine status)static InputStreamsafelyOfferEntityStreamExternally(org.apache.http.client.methods.CloseableHttpResponse response, EventLogger eventLogger)Do proper resource handling in the case when offering thestreamfrom 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 thestreamfrom 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)
-
-