public final class ResponseCodeEnforcingResponseHandler extends Object implements org.apache.hc.core5.http.io.HttpClientResponseHandler<Integer>
HttpResponseException
for all response codes except for the accepted ones.
In addition optionally checks for a certain content type and content of the response.
Returns the response code if all checks pass.Constructor and Description |
---|
ResponseCodeEnforcingResponseHandler(Integer... allowedCodes) |
ResponseCodeEnforcingResponseHandler(String expectedContentType,
Integer... allowedCodes) |
ResponseCodeEnforcingResponseHandler(String expectedContentType,
Predicate<String> responseStringPredicate,
Integer... allowedCodes) |
Modifier and Type | Method and Description |
---|---|
Integer |
handleResponse(org.apache.hc.core5.http.ClassicHttpResponse response) |
public ResponseCodeEnforcingResponseHandler(Integer... allowedCodes)
public ResponseCodeEnforcingResponseHandler(String expectedContentType, Integer... allowedCodes)
public Integer handleResponse(org.apache.hc.core5.http.ClassicHttpResponse response) throws org.apache.hc.core5.http.HttpException, IOException
handleResponse
in interface org.apache.hc.core5.http.io.HttpClientResponseHandler<Integer>
org.apache.hc.core5.http.HttpException
IOException
Copyright © 2007–2022 The Apache Software Foundation. All rights reserved.