INT-1519, INT-957, INT-1515, Added support for propagating XML Validation exceptions with MessageRejectedException, added support for 'xml-validator' attribute, change XmlValidatingMessageSelector to be bootstrapped with either Resource/Schema or XmlValidator

This commit is contained in:
Oleg Zhurakousky
2010-10-14 14:12:54 -04:00
parent e738d34535
commit fc51593001
7 changed files with 186 additions and 38 deletions

View File

@@ -100,14 +100,24 @@ public class MessageFilter extends AbstractReplyProducingMessageHandler {
@Override
protected Object handleRequestMessage(Message<?> message) {
if (this.selector.accept(message)) {
return message;
}
Throwable filterException = null;
try {
if (this.selector.accept(message)) {
return message;
}
} catch (Exception e) {
filterException = e;
}
if (this.discardChannel != null) {
this.getMessagingTemplate().send(this.discardChannel, message);
}
if (this.throwExceptionOnRejection) {
throw new MessageRejectedException(message, "MessageFilter '" + this.getComponentName() + "' rejected Message");
if (filterException != null){
throw new MessageRejectedException(message, "MessageFilter '" + this.getComponentName() + "' rejected Message", filterException);
}
else {
throw new MessageRejectedException(message, "MessageFilter '" + this.getComponentName() + "' rejected Message");
}
}
return null;
}