Package com.luna.common.net.hander
Class ValidatingResponseHandler<T>
java.lang.Object
org.apache.hc.client5.http.impl.classic.AbstractHttpClientResponseHandler<T>
com.luna.common.net.hander.ValidatingResponseHandler<T>
- Type Parameters:
T- return type ofHttpClientResponseHandler.handleResponse(ClassicHttpResponse)(HttpResponse)}.
- All Implemented Interfaces:
org.apache.hc.core5.http.io.HttpClientResponseHandler<T>
public abstract class ValidatingResponseHandler<T>
extends org.apache.hc.client5.http.impl.classic.AbstractHttpClientResponseHandler<T>
Basic response handler which takes an url for documentation.
- Author:
- luna
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionhandleEntity(org.apache.hc.core5.http.HttpEntity entity) handleResponse(org.apache.hc.core5.http.ClassicHttpResponse response) protected voidvalidateResponse(org.apache.hc.core5.http.HttpResponse response) Checks the response for a statuscode betweenHttpStatus.SC_OKandHttpStatus.SC_MULTIPLE_CHOICESand throws anRuntimeExceptionotherwise.
-
Constructor Details
-
ValidatingResponseHandler
public ValidatingResponseHandler()
-
-
Method Details
-
validateResponse
protected void validateResponse(org.apache.hc.core5.http.HttpResponse response) Checks the response for a statuscode betweenHttpStatus.SC_OKandHttpStatus.SC_MULTIPLE_CHOICESand throws anRuntimeExceptionotherwise.- Parameters:
response- to check- Throws:
RuntimeException- when the status code is not acceptable.
-
handleResponse
-
handleEntity
- Specified by:
handleEntityin classorg.apache.hc.client5.http.impl.classic.AbstractHttpClientResponseHandler<T>
-