Class AbstractInternalEndpointClient
java.lang.Object
es.kukenan.smartfi.microservice.communication.service.api.AbstractEndpointClient
es.kukenan.smartfi.microservice.communication.service.api.AbstractInternalEndpointClient
- Direct Known Subclasses:
BackofficeEndpoints,LabsMobileEndpoints
Base class with core funcionality for any endpoint implementation.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final StringAPI base path.static final StringUser profile identifier header.protected InternalRestTemplateConfigurationRest template.static final Stringuser ip internal header attribute. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddAuthorization(org.springframework.http.HttpHeaders httpHeaders) Add authorization parameters to the given http headers.org.springframework.http.HttpHeadersdefaultRequestHeaders(String contentType, String userId) Create the default request HTTP headers used in any Core API method.protected org.springframework.http.HttpHeadersdefaultRequestHeaders(String contentType, String userId, String userIp) protected <T> TextractResponseData(org.springframework.http.ResponseEntity<T> responseEntity) Extract the response data from the givenResponseEntity.Methods inherited from class es.kukenan.smartfi.microservice.communication.service.api.AbstractEndpointClient
createUri, createUri, defaultRequestHeaders, defaultRequestHeaders, handleConnectionException, message
-
Field Details
-
HEADER_USERPROFILEID
User profile identifier header.- See Also:
-
USER_IP_HEADER
user ip internal header attribute.- See Also:
-
endpointBasePath
API base path. -
restTemplate
Rest template.
-
-
Constructor Details
-
AbstractInternalEndpointClient
Base constructor.- Parameters:
endpointBasePath- the base path of this endpoint.
-
-
Method Details
-
extractResponseData
protected <T> T extractResponseData(org.springframework.http.ResponseEntity<T> responseEntity) Extract the response data from the givenResponseEntity.- Type Parameters:
T- MinsaitResponse type.- Parameters:
responseEntity-ResponseEntity.- Returns:
- minsait response data.
-
addAuthorization
private void addAuthorization(org.springframework.http.HttpHeaders httpHeaders) Add authorization parameters to the given http headers.- Parameters:
httpHeaders- http headers to update with the correct credentials to invoke Core API.
-
defaultRequestHeaders
public org.springframework.http.HttpHeaders defaultRequestHeaders(String contentType, String userId) Create the default request HTTP headers used in any Core API method.- Overrides:
defaultRequestHeadersin classAbstractEndpointClient- Parameters:
contentType- request body content type. Can be null.userId- user identifier, mandatory.- Returns:
- the default request HTTP headers used in any Core API method.
-
defaultRequestHeaders
-