Package com.almis.awe.service.connector
Class AbstractRestConnector
java.lang.Object
com.almis.awe.config.ServiceConfig
com.almis.awe.service.connector.AbstractRestConnector
- All Implemented Interfaces:
ServiceConnector
,org.springframework.beans.factory.Aware
,org.springframework.context.ApplicationContextAware
- Direct Known Subclasses:
MicroserviceConnector
,RestConnector
Launches a Rest service
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractRestConnector
(org.springframework.http.client.ClientHttpRequestFactory requestFactory, com.fasterxml.jackson.databind.ObjectMapper objectMapper) Autowired constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected void
checkServiceResponse
(ServiceData serviceData) Check service response and send exception if failed or warningprotected ServiceData
Generates the request and launches itprotected org.springframework.http.HttpEntity
generateRequest
(AbstractServiceRest rest, org.springframework.web.util.UriComponentsBuilder uriBuilder, Map<String, Object> urlParameters, Map<String, Object> paramsMapFromRequest) Generate rest requestLaunches a subscription to a serviceMethods inherited from class com.almis.awe.config.ServiceConfig
containsBean, getApplicationContext, getBean, getBean, getElements, getLocale, getLocale, getProperty, getProperty, getRequest, getSession, setApplicationContext
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.almis.awe.service.connector.ServiceConnector
launch
-
Constructor Details
-
AbstractRestConnector
protected AbstractRestConnector(org.springframework.http.client.ClientHttpRequestFactory requestFactory, com.fasterxml.jackson.databind.ObjectMapper objectMapper) Autowired constructor- Parameters:
requestFactory
- Request factoryobjectMapper
- Object Mapper
-
-
Method Details
-
doRequest
protected ServiceData doRequest(String url, AbstractServiceRest service, Map<String, Object> paramsMapFromRequest) throws AWExceptionGenerates the request and launches it- Parameters:
url
- where the rest service is locatedservice
- object informationparamsMapFromRequest
- parameter values received- Returns:
- response
- Throws:
AWException
- Error launching request
-
generateRequest
protected org.springframework.http.HttpEntity generateRequest(AbstractServiceRest rest, org.springframework.web.util.UriComponentsBuilder uriBuilder, Map<String, Object> urlParameters, Map<String, throws com.fasterxml.jackson.core.JsonProcessingExceptionObject> paramsMapFromRequest) Generate rest request- Parameters:
rest
- Rest serviceuriBuilder
- Url BuilderurlParameters
- Url parametersparamsMapFromRequest
- Request parameters- Returns:
- Request
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
- SeeJsonProcessingException
-
checkServiceResponse
Check service response and send exception if failed or warning- Parameters:
serviceData
- Service data- Throws:
AWException
- Service data is error or warning
-
subscribe
Launches a subscription to a service- Parameters:
query
- Subscribed query- Returns:
- Service data
-