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
-
Method Summary
Modifier and TypeMethodDescriptionhandleEntity
(org.apache.hc.core5.http.HttpEntity entity) handleResponse
(org.apache.hc.core5.http.ClassicHttpResponse response) protected void
validateResponse
(org.apache.hc.core5.http.HttpResponse response) Checks the response for a statuscode betweenHttpStatus.SC_OK
andHttpStatus.SC_MULTIPLE_CHOICES
and throws anRuntimeException
otherwise.
-
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_OK
andHttpStatus.SC_MULTIPLE_CHOICES
and throws anRuntimeException
otherwise.- Parameters:
response
- to check- Throws:
RuntimeException
- when the status code is not acceptable.
-
handleResponse
-
handleEntity
- Specified by:
handleEntity
in classorg.apache.hc.client5.http.impl.classic.AbstractHttpClientResponseHandler<T>
-