Package org.springframework.web.bind

Examples of org.springframework.web.bind.MissingServletRequestParameterException


    assertEquals("Invalid Accept header", "application/pdf", response.getHeader("Accept"));
  }

  @Test
  public void handleMissingServletRequestParameter() {
    MissingServletRequestParameterException ex = new MissingServletRequestParameterException("foo", "bar");
    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());
    assertEquals("Required bar parameter 'foo' is not present", response.getErrorMessage());
View Full Code Here


          customArgumentResolvers, messageConverters);
    }

    @Override
    protected void raiseMissingParameterException(String paramName, Class paramType) throws Exception {
      throw new MissingServletRequestParameterException(paramName, paramType.getName());
    }
View Full Code Here

          parameterNameDiscoverer, customArgumentResolvers);
    }

    @Override
    protected void raiseMissingParameterException(String paramName, Class paramType) throws Exception {
      throw new MissingServletRequestParameterException(paramName, paramType.getName());
    }
View Full Code Here

          customArgumentResolvers, messageConverters);
    }

    @Override
    protected void raiseMissingParameterException(String paramName, Class paramType) throws Exception {
      throw new MissingServletRequestParameterException(paramName, paramType.getSimpleName());
    }
View Full Code Here

     *          if the required parameter identifier is nto available
     */
    @RequestMapping(method = RequestMethod.DELETE)
    public void delete(@RequestBody ContactEntry contact) throws MissingServletRequestParameterException {
        if (!StringUtils.hasText(contact.getIdentifier())) {
            throw new MissingServletRequestParameterException("identifier", "String");
        }
        RemoveContactCommand command = new RemoveContactCommand();
        command.setContactId(contact.getIdentifier());
        commandBus.dispatch(new GenericCommandMessage<Object>(command));
    }
View Full Code Here

     *          if the type or identifier are not provided
     */
    @RequestMapping(value = "{identifier}/address", method = RequestMethod.DELETE)
    public void deleteAddress(@RequestBody AddressEntry address) throws MissingServletRequestParameterException {
        if (!StringUtils.hasText(address.getIdentifier())) {
            throw new MissingServletRequestParameterException("identifier", "String");
        }
        if (null == address.getAddressType()) {
            throw new MissingServletRequestParameterException("addressType", "PRIVATE,WORK,VACATION");
        }
        RemoveAddressCommand command = new RemoveAddressCommand();
        command.setContactId(address.getIdentifier());
        command.setAddressType(address.getAddressType());
        commandBus.dispatch(new GenericCommandMessage<Object>(command));
View Full Code Here

TOP

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

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.