Package org.springframework.web.bind

Examples of org.springframework.web.bind.ServletRequestBindingException


  }

  @Test
  public void handleServletRequestBindingException() {
    String message = "Missing required value - header, cookie, or pathvar";
    ServletRequestBindingException ex = new ServletRequestBindingException(message);
    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


    // must go straight through
    testExceptionNoHandler(new ServletException());

    // subclass of servlet exception
    testExceptionNoHandler(new ServletRequestBindingException("foo"));
    testExceptionNoHandler(new RuntimeException());
    testExceptionNoHandler(new Error());
  }
View Full Code Here

    mc = new TestServletExceptionHandler();
    mv = testHandlerCaughtException(mc, new ServletException());
    assertTrue(mv.getViewName().equals("handle(ServletException)"));
    assertTrue("Invoke correct method", mc.wasInvoked("handle(ServletException)"));

    mv = testHandlerCaughtException(mc, new ServletRequestBindingException("foo"));
    assertTrue(mv.getViewName().equals("handle(ServletException)"));
    assertTrue("Invoke correct method", mc.wasInvoked("handle(ServletException)"));

    // Check it doesn't affect unknown exceptions
    testExceptionNoHandler(mc, new RuntimeException());
View Full Code Here

      throw new UnsatisfiedServletRequestParameterException(mappedParams, request.getParameterMap());
    }

    String[] mappedHeaders = mapping.headers();
    if (!ServletAnnotationMappingUtils.checkHeaders(mappedHeaders, request)) {
      throw new ServletRequestBindingException("Header conditions \"" +
          StringUtils.arrayToDelimitedString(mappedHeaders, ", ") +
          "\" not met for actual request");
    }
  }
View Full Code Here

      throw new UnsatisfiedServletRequestParameterException(mappedParams, request.getParameterMap());
    }

    String[] mappedHeaders = mapping.headers();
    if (!ServletAnnotationMappingUtils.checkHeaders(mappedHeaders, request)) {
      throw new ServletRequestBindingException("Header conditions \"" +
          StringUtils.arrayToDelimitedString(mappedHeaders, ", ") +
          "\" not met for actual request");
    }
  }
View Full Code Here

     * @throws ServletRequestBindingException subclass of ServletException
     *         on any binding problem
     */
    public void closeNoCatch() throws ServletRequestBindingException {
        if (getBindingResult().hasErrors()) {
            throw new ServletRequestBindingException("Errors binding onto object '"
                    + getBindingResult().getObjectName() + "'", new BindException(
                    getBindingResult()));
        }
    }
View Full Code Here

     * @throws ServletRequestBindingException subclass of ServletException
     *         on any binding problem
     */
    public void closeNoCatch() throws ServletRequestBindingException {
        if (getBindingResult().hasErrors()) {
            throw new ServletRequestBindingException("Errors binding onto object '"
                    + getBindingResult().getObjectName() + "'", new BindException(
                    getBindingResult()));
        }
    }
View Full Code Here

TOP

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

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.