@Override
public Object invoke(Exchange exchange, final Object serviceObject, Method m, List<Object> params) {
Message message = JAXRSUtils.getCurrentMessage();
ValidationProvider theProvider = getProvider(message);
if (isValidateServiceObject()) {
theProvider.validateBean(serviceObject);
}
theProvider.validateParameters(serviceObject, m, params.toArray());
Object response = super.invoke(exchange, serviceObject, m, params);
if (response instanceof MessageContentsList) {
MessageContentsList list = (MessageContentsList)response;
if (list.size() == 1) {
Object entity = ((MessageContentsList)list).get(0);
if (entity instanceof Response) {
theProvider.validateReturnValue(serviceObject, m, ((Response)entity).getEntity());
} else {
theProvider.validateReturnValue(serviceObject, m, entity);
}
}
}
return response;