Package org.springframework.web.bind

Examples of org.springframework.web.bind.MethodArgumentNotValidException


        Object hints = AnnotationUtils.getValue(annot);
        binder.validate(hints instanceof Object[] ? (Object[]) hints : new Object[] {hints});
        BindingResult bindingResult = binder.getBindingResult();
        if (bindingResult.hasErrors()) {
          if (isBindExceptionRequired(binder, parameter)) {
            throw new MethodArgumentNotValidException(parameter, bindingResult);
          }
        }
        break;
      }
    }
View Full Code Here


              WebDataBinder binder = binderFactory.createBinder(request, arg, partName);
              Object hints = AnnotationUtils.getValue(annot);
              binder.validate(hints instanceof Object[] ? (Object[]) hints : new Object[] {hints});
              BindingResult bindingResult = binder.getBindingResult();
              if (bindingResult.hasErrors()) {
                throw new MethodArgumentNotValidException(parameter, bindingResult);
              }
            }
          }
        }
      }
View Full Code Here

        Object hints = AnnotationUtils.getValue(annot);
        binder.validate(hints instanceof Object[] ? (Object[]) hints : new Object[] {hints});
        BindingResult bindingResult = binder.getBindingResult();
        if (bindingResult.hasErrors()) {
          if (isBindExceptionRequired(binder, parameter)) {
            throw new MethodArgumentNotValidException(parameter, bindingResult);
          }
        }
      }
    }
  }
View Full Code Here

        WebDataBinder binder = binderFactory.createBinder(webRequest, arg, name);
        Object hints = AnnotationUtils.getValue(annot);
        binder.validate(hints instanceof Object[] ? (Object[]) hints : new Object[] {hints});
        BindingResult bindingResult = binder.getBindingResult();
        if (bindingResult.hasErrors()) {
          throw new MethodArgumentNotValidException(parameter, bindingResult);
        }
      }
    }
    return arg;
  }
View Full Code Here

        Object hints = AnnotationUtils.getValue(ann);
        binder.validate(hints instanceof Object[] ? (Object[]) hints : new Object[] {hints});
        BindingResult bindingResult = binder.getBindingResult();
        if (bindingResult.hasErrors()) {
          if (isBindExceptionRequired(binder, parameter)) {
            throw new MethodArgumentNotValidException(parameter, bindingResult);
          }
        }
        break;
      }
    }
View Full Code Here

        Object hints = AnnotationUtils.getValue(annot);
        binder.validate(hints instanceof Object[] ? (Object[]) hints : new Object[] {hints});
        BindingResult bindingResult = binder.getBindingResult();
        if (bindingResult.hasErrors()) {
          if (isBindingErrorFatal(parameter)) {
            throw new MethodArgumentNotValidException(parameter, bindingResult);
          }
        }
      }
    }
  }
View Full Code Here

    testException(ex);
  }

  @Test
  public void methodArgumentNotValid() {
    Exception ex = new MethodArgumentNotValidException(null, null);
    testException(ex);
  }
View Full Code Here

  @Test
  public void handleMethodArgumentNotValid() throws Exception {
    BeanPropertyBindingResult errors = new BeanPropertyBindingResult(new TestBean(), "testBean");
    errors.rejectValue("name", "invalid");
    MethodParameter parameter = new MethodParameter(this.getClass().getMethod("handle", String.class), 0);
    MethodArgumentNotValidException ex = new MethodArgumentNotValidException(parameter, errors);
    ModelAndView mav = exceptionResolver.resolveException(request, response, null, ex);
    assertNotNull("No ModelAndView returned", mav);
    assertTrue("No Empty ModelAndView returned", mav.isEmpty());
    assertEquals("Invalid status code", 400, response.getStatus());
  }
View Full Code Here

TOP

Related Classes of org.springframework.web.bind.MethodArgumentNotValidException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.