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 of HttpClientResponseHandler.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 Details

    • ValidatingResponseHandler

      public ValidatingResponseHandler()
  • Method Details

    • validateResponse

      protected void validateResponse(org.apache.hc.core5.http.HttpResponse response)
      Checks the response for a statuscode between HttpStatus.SC_OK and HttpStatus.SC_MULTIPLE_CHOICES and throws an RuntimeException otherwise.
      Parameters:
      response - to check
      Throws:
      RuntimeException - when the status code is not acceptable.
    • handleResponse

      public T handleResponse(org.apache.hc.core5.http.ClassicHttpResponse response)
      Specified by:
      handleResponse in interface org.apache.hc.core5.http.io.HttpClientResponseHandler<T>
      Overrides:
      handleResponse in class org.apache.hc.client5.http.impl.classic.AbstractHttpClientResponseHandler<T>
    • handleEntity

      public T handleEntity(org.apache.hc.core5.http.HttpEntity entity)
      Specified by:
      handleEntity in class org.apache.hc.client5.http.impl.classic.AbstractHttpClientResponseHandler<T>