Class ResponseUtils
- java.lang.Object
-
- no.digipost.api.useragreements.client.response.ResponseUtils
-
public final class ResponseUtils extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Optional<Exception>close(AutoCloseable... closeables)static InputStreamgetResponseEntityContent(org.apache.http.HttpResponse response)static Optional<String>getValueOfFirstHeader(org.apache.http.HttpResponse response, String headerName)static booleanisOkResponse(int statusCode)static booleanisOkResponse(org.apache.http.HttpResponse response)static booleanisOkResponse(org.apache.http.StatusLine status)static <T> TmapOkResponseOrThrowException(org.apache.http.HttpResponse response, Function<org.apache.http.HttpResponse,T> okResponseMapper)static Optional<Duration>parseDelayDurationOfRetryAfterHeader(org.apache.http.HttpResponse response)static Optional<Duration>parseDelayDurationOfRetryAfterHeader(org.apache.http.HttpResponse response, Clock clock)static ErrorreadErrorEntity(org.apache.http.HttpResponse response)static Stream<String>streamDelimitedStringsOf(InputStream inputStream, Charset charset, Pattern delimiter)static Stream<String>streamXmlDocumentsOf(InputStream inputStream)static <T> Stream<T>unmarshallEntities(org.apache.http.HttpResponse response, Class<T> returnType)static <T> TunmarshallEntity(org.apache.http.HttpResponse response, Class<T> returnType)
-
-
-
Method Detail
-
mapOkResponseOrThrowException
public static <T> T mapOkResponseOrThrowException(org.apache.http.HttpResponse response, Function<org.apache.http.HttpResponse,T> okResponseMapper)
-
unmarshallEntity
public static <T> T unmarshallEntity(org.apache.http.HttpResponse response, Class<T> returnType)
-
unmarshallEntities
public static <T> Stream<T> unmarshallEntities(org.apache.http.HttpResponse response, Class<T> returnType)
-
readErrorEntity
public static Error readErrorEntity(org.apache.http.HttpResponse response)
-
getResponseEntityContent
public static InputStream getResponseEntityContent(org.apache.http.HttpResponse response)
-
streamXmlDocumentsOf
public static Stream<String> streamXmlDocumentsOf(InputStream inputStream)
-
streamDelimitedStringsOf
public static Stream<String> streamDelimitedStringsOf(InputStream inputStream, Charset charset, Pattern delimiter)
-
close
public static Optional<Exception> close(AutoCloseable... closeables)
-
parseDelayDurationOfRetryAfterHeader
public static Optional<Duration> parseDelayDurationOfRetryAfterHeader(org.apache.http.HttpResponse response)
-
parseDelayDurationOfRetryAfterHeader
public static Optional<Duration> parseDelayDurationOfRetryAfterHeader(org.apache.http.HttpResponse response, Clock clock)
-
getValueOfFirstHeader
public static Optional<String> getValueOfFirstHeader(org.apache.http.HttpResponse response, String headerName)
-
isOkResponse
public static boolean isOkResponse(org.apache.http.HttpResponse response)
-
isOkResponse
public static boolean isOkResponse(org.apache.http.StatusLine status)
-
isOkResponse
public static boolean isOkResponse(int statusCode)
-
-