Package org.chenile.proxy.interceptors
Class HttpInvoker
java.lang.Object
org.chenile.proxy.interceptors.HttpInvoker
- All Implemented Interfaces:
Command<ChenileExchange>
Invokes the remote service using HTTP
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Stringprivate ObjectMapper(package private) org.springframework.boot.web.client.RestTemplateBuilder -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static StringconstructUrl(String contextPath, String url, ChenileExchange exchange) Constructs the URL taking care of path variablesvoidexecute(ChenileExchange exchange) private HttpHeadersextractHeaders(ChenileExchange exchange) protected RestTemplategetRestTemplate(ChenileExchange chenileExchange) private HttpMethodprivate voidpopulateResponse(ResponseEntity<GenericResponse<?>> httpResponse, String baseURI, String serviceOpName, ChenileExchange exchange) private voidsetCorrectException(ChenileExchange exchange, Object[] eArgs, RestClientException e)
-
Field Details
-
contextPath
-
restTemplateBuilder
-
objectMapper
-
-
Constructor Details
-
HttpInvoker
public HttpInvoker()
-
-
Method Details
-
execute
- Specified by:
executein interfaceCommand<ChenileExchange>- Throws:
Exception
-
populateResponse
private void populateResponse(ResponseEntity<GenericResponse<?>> httpResponse, String baseURI, String serviceOpName, ChenileExchange exchange) -
setCorrectException
-
constructUrl
Constructs the URL taking care of path variables- Parameters:
url- - the url inclusive of path variableexchange- - the chenile exchange- Returns:
- the new URL with paths substituted if required
-
extractHeaders
-
httpMethod
-
getRestTemplate
-