Package com.moesif.api.controllers
Class BaseController
java.lang.Object
com.moesif.api.controllers.BaseController
- Direct Known Subclasses:
APIController,HealthController
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected HttpCallBackProtected variable to keep reference of httpCallBack instance if user provides any -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic HttpClientShared instance of the Http clientGet 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 Details
-
httpCallBack
Protected variable to keep reference of httpCallBack instance if user provides any
-
-
Constructor Details
-
BaseController
public BaseController()
-
-
Method Details
-
getHttpCallBack
Get httpCallBack associated with this controller- Returns:
- HttpCallBack
-
setHttpCallBack
Set the httpCallBack for this controller- Parameters:
httpCallBack- called after HTTP response is received
-
getClientInstance
Shared instance of the Http client- Returns:
- The shared instance of the http client
-
setClientInstance
Shared instance of the Http client- Parameters:
client- The shared instance of the http client
-
validateResponse
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
-