RESTEasyBindingData responseData = _serviceConsumer.invoke(requestData, method.getReturnType().equals(Void.TYPE));
if (method.getReturnType().equals(Response.class)) {
Response.ResponseBuilder builder = Response.ok();
if (responseData != null) {
if (responseData.getStatusCode() != null) {
builder.status(responseData.getStatusCode());
}
if (responseData.getParameters().length > 0) {
builder.entity(responseData.getParameters()[0]);
}
for (Map.Entry<String, List<String>> entry : responseData.getHeaders().entrySet()) {
builder.header(entry.getKey(), entry.getValue());
}
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Outgoing Headers from SwitchYard through InboundHandler [");
for (Map.Entry<String, List<String>> entry : responseData.getHeaders().entrySet()) {
LOGGER.trace(entry.getKey() + " = " + entry.getValue());
}
LOGGER.trace("]");
}
}
return builder.build();
} else if ((responseData != null) && (responseData.getParameters().length > 0)) {
return responseData.getParameters()[0];
}
return null;