Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
   * Copyright 2005-2010 the original author or authors.
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
Extension of the AbstractMarshallingPayloadEndpoint which validates the request payload with org.springframework.validation.Validator(s). The desired validators can be set using properties, and must org.springframework.validation.Validator.supports(java.lang.Class) the request object.

Arjen Poutsma
Default request object name used for validating request objects.
     public static final String DEFAULT_REQUEST_NAME = "request";
     private String requestName = ;
     private Validator[] validators;

Return the name of the request object for validation error codes.
     public String getRequestName() {
         return ;

Set the name of the request object user for validation errors.
     public void setRequestName(String requestName) {
         this. = requestName;

Return the primary Validator for this controller.
     public Validator getValidator() {
         Validator[] validators = getValidators();
         return (validators != null && validators.length > 0 ? validators[0] : null);

Set the primary org.springframework.validation.Validator for this endpoint. The org.springframework.validation.Validator is must support the unmarshalled class. If there are one or more existing validators set already when this method is called, only the specified validator will be kept. Use setValidators(org.springframework.validation.Validator[]) to set multiple validators.
     public void setValidator(Validator validator) {
         this. = new Validator[]{validator};

Return the Validators for this controller.
     public Validator[] getValidators() {
         return ;

Set the Validators for this controller. The Validator must support the specified command class.
     public void setValidators(Validator[] validators) {
         this. = validators;
     protected boolean onUnmarshalRequest(MessageContext messageContextObject requestObjectthrows Exception {
         Validator[] validators = getValidators();
         if (validators != null) {
             Errors errors = new BindException(requestObjectgetRequestName());
             for (Validator validator : validators) {
             if (errors.hasErrors()) {
                 return onValidationErrors(messageContextrequestObjecterrors);
         return true;

Callback for post-processing validation errors. Called when validator(s) have been specified, and validation fails.

messageContext the message context
requestObject the object unmarshalled from the request
errors validation errors holder
true to continue and call AbstractMarshallingPayloadEndpoint.invokeInternal(java.lang.Object); false otherwise
    protected abstract boolean onValidationErrors(MessageContext messageContextObject requestObjectErrors errors);
New to GrepCode? Check out our FAQ X