for (Map.Entry<String, Object> p : matrixParams.entrySet()) {
uriBuilder.replaceMatrixParam(p.getKey(), p.getValue());
}
uri = uriBuilder.buildFromMap(pathParams);
Resource resource = restClient.resource(uri);
for (Map.Entry<String, Object> p : headerParams.entrySet()) {
resource.header(p.getKey(), String.valueOf(p.getValue()));
}
for (Map.Entry<String, Object> p : cookieParams.entrySet()) {
Cookie cookie = new Cookie(p.getKey(), String.valueOf(p.getValue()));
resource.cookie(cookie);
}
resource.contentType(getContentType());
resource.accept(getAccepts());
//handles declarative headers configured on the composite
for (HTTPHeader header : binding.getHttpHeaders()) {
//treat special headers that need to be calculated
if (header.getName().equalsIgnoreCase("Expires")) {
GregorianCalendar calendar = new GregorianCalendar();
calendar.setTime(new Date());
calendar.add(Calendar.HOUR, Integer.parseInt(header.getValue()));
resource.header("Expires", HTTPCacheContext.RFC822DateFormat.format(calendar.getTime()));
} else {
//default behaviour to pass the header value to HTTP response
resource.header(header.getName(), header.getValue());
}
}
Object result = resource.invoke(httpMethod, responseType, entity);
msg.setBody(result);
return msg;
}