Package org.springframework.web.bind

Examples of org.springframework.web.bind.ServletRequestBindingException


    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


      paramValues = new ArrayList<String>();
      for (MultiValueMap<String, String> params : pathParameters.values()) {
        if (params.containsKey(name)) {
          if (found) {
            String paramType = parameter.getParameterType().getName();
            throw new ServletRequestBindingException(
                "Found more than one match for URI path parameter '" + name +
                "' for parameter type [" + paramType + "]. Use pathVar attribute to disambiguate.");
          }
          paramValues.addAll(params.get(name));
          found = true;
View Full Code Here

    }
  }

  @Override
  protected void handleMissingValue(String name, MethodParameter parameter) throws ServletRequestBindingException {
    throw new ServletRequestBindingException("Missing matrix variable '" + name +
        "' for method parameter of type " + parameter.getParameterType().getSimpleName());
  }
View Full Code Here

    return (uriTemplateVars != null) ? uriTemplateVars.get(name) : null;
  }

  @Override
  protected void handleMissingValue(String name, MethodParameter parameter) throws ServletRequestBindingException {
    throw new ServletRequestBindingException("Missing URI template variable '" + name +
        "' for method parameter of type " + parameter.getParameterType().getSimpleName());
  }
View Full Code Here

      }
      if (request.getParameter("access") != null) {
        throw new IllegalAccessException("illegal access");
      }
      if (request.getParameter("servlet") != null) {
        throw new ServletRequestBindingException("servlet");
      }
      if (request.getParameter("exception") != null) {
        throw new RuntimeException("servlet");
      }
      if (!(RequestContextUtils.getLocaleResolver(request) instanceof SessionLocaleResolver)) {
View Full Code Here

    return new CookieValueNamedValueInfo(annotation);
  }

  @Override
  protected void handleMissingValue(String name, MethodParameter parameter) throws ServletRequestBindingException {
    throw new ServletRequestBindingException("Missing cookie '" + name +
        "' for method parameter of type " + parameter.getParameterType().getSimpleName());
  }
View Full Code Here

    }
  }

  @Override
  protected void handleMissingValue(String name, MethodParameter parameter) throws ServletRequestBindingException {
    throw new ServletRequestBindingException("Missing request header '" + name +
        "' for method parameter of type " + parameter.getParameterType().getSimpleName());
  }
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

    testException(ex);
  }

  @Test
  public void servletRequestBindingException() {
    Exception ex = new ServletRequestBindingException("message");
    testException(ex);
  }
View Full Code Here

    ExceptionHandlerExceptionResolver resolver = new ExceptionHandlerExceptionResolver();
    resolver.setApplicationContext(cxt);
    resolver.afterPropertiesSet();

    ServletRequestBindingException ex = new ServletRequestBindingException("message");
    resolver.resolveException(this.servletRequest, this.servletResponse, null, ex);

    assertEquals(400, this.servletResponse.getStatus());
    assertEquals("error content", this.servletResponse.getContentAsString());
    assertEquals("someHeaderValue", this.servletResponse.getHeader("someHeader"));
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.