问题
I have to validate the incoming json payload and throw custom errors if the json is not valid. I tried implementing the validator interface as shown in the above image. But how should I access the payload now?In earlier versions the method accepted a mule event through which we could easily get the payload:
public interface Validator
{
/**
* Performs the validation and generates a
* {@link ValidationResult} back.
*
* @param event the current {@link MuleEvent}
* @return a {@link ValidationResult}
*/
ValidationResult validate(MuleEvent event);
}
来源:https://stackoverflow.com/questions/59529130/how-to-access-the-payload-when-implementing-the-validator-interface