Class BaseController

java.lang.Object
com.moesif.api.controllers.BaseController
Direct Known Subclasses:
APIController, HealthController

public abstract class BaseController extends Object
  • Field Details

    • httpCallBack

      protected HttpCallBack httpCallBack
      Protected variable to keep reference of httpCallBack instance if user provides any
  • Constructor Details

    • BaseController

      public BaseController()
  • Method Details

    • getHttpCallBack

      public HttpCallBack getHttpCallBack()
      Get httpCallBack associated with this controller
      Returns:
      HttpCallBack
    • setHttpCallBack

      public void setHttpCallBack(HttpCallBack httpCallBack)
      Set the httpCallBack for this controller
      Parameters:
      httpCallBack - called after HTTP response is received
    • getClientInstance

      public static HttpClient getClientInstance()
      Shared instance of the Http client
      Returns:
      The shared instance of the http client
    • setClientInstance

      public static void setClientInstance(HttpClient client)
      Shared instance of the Http client
      Parameters:
      client - The shared instance of the http client
    • validateResponse

      protected void validateResponse(HttpResponse response, HttpContext context) throws APIException
      Validates the response against HTTP errors defined at the API level
      Parameters:
      response - The response recieved
      context - Context of the request and the recieved response
      Throws:
      APIException - invalid response