Package com.moesif.api.controllers
Class BaseController
- java.lang.Object
-
- com.moesif.api.controllers.BaseController
-
- Direct Known Subclasses:
APIController,HealthController
public abstract class BaseController extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected HttpCallBackhttpCallBackProtected variable to keep reference of httpCallBack instance if user provides any
-
Constructor Summary
Constructors Constructor Description BaseController()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static HttpClientgetClientInstance()Shared instance of the Http clientHttpCallBackgetHttpCallBack()Get httpCallBack associated with this controllerstatic voidsetClientInstance(HttpClient client)Shared instance of the Http clientvoidsetHttpCallBack(HttpCallBack httpCallBack)Set the httpCallBack for this controllerprotected voidvalidateResponse(HttpResponse response, HttpContext context)Validates the response against HTTP errors defined at the API level
-
-
-
Field Detail
-
httpCallBack
protected HttpCallBack httpCallBack
Protected variable to keep reference of httpCallBack instance if user provides any
-
-
Method Detail
-
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 recievedcontext- Context of the request and the recieved response- Throws:
APIException- invalid response
-
-