Package org.springframework.web.bind.support

Examples of org.springframework.web.bind.support.WebDataBinderFactory


  private ModelAndView invokeHandleMethod(HttpServletRequest request,
      HttpServletResponse response, HandlerMethod handlerMethod) throws Exception {

    ServletWebRequest webRequest = new ServletWebRequest(request, response);

    WebDataBinderFactory binderFactory = getDataBinderFactory(handlerMethod);
    ModelFactory modelFactory = getModelFactory(handlerMethod, binderFactory);
    ServletInvocableHandlerMethod requestMappingMethod = createRequestMappingMethod(handlerMethod, binderFactory);

    ModelAndViewContainer mavContainer = new ModelAndViewContainer();
    mavContainer.addAllAttributes(RequestContextUtils.getInputFlashMap(request));
View Full Code Here


  private ModelAndView invokeHandlerMethod(HttpServletRequest request, HttpServletResponse response,
      HandlerMethod handlerMethod) throws Exception {
   
    ServletWebRequest webRequest = new ServletWebRequest(request, response);

    WebDataBinderFactory binderFactory = getDataBinderFactory(handlerMethod);
    ModelFactory modelFactory = getModelFactory(handlerMethod, binderFactory);
    ServletInvocableHandlerMethod requestMappingMethod = createRequestMappingMethod(handlerMethod, binderFactory);

    ModelAndViewContainer mavContainer = new ModelAndViewContainer();
    mavContainer.addAllAttributes(RequestContextUtils.getInputFlashMap(request));
View Full Code Here

  private ModelAndView invokeHandleMethod(HttpServletRequest request,
      HttpServletResponse response, HandlerMethod handlerMethod) throws Exception {

    ServletWebRequest webRequest = new ServletWebRequest(request, response);

    WebDataBinderFactory binderFactory = getDataBinderFactory(handlerMethod);
    ModelFactory modelFactory = getModelFactory(handlerMethod, binderFactory);
    ServletInvocableHandlerMethod requestMappingMethod = createRequestMappingMethod(handlerMethod, binderFactory);

    ModelAndViewContainer mavContainer = new ModelAndViewContainer();
    mavContainer.addAllAttributes(RequestContextUtils.getInputFlashMap(request));
View Full Code Here

    webRequest = new ServletWebRequest(new MockHttpServletRequest());
  }

  @Test
  public void createBinder() throws Exception {
    WebDataBinderFactory factory = createBinderFactory("initBinder", WebDataBinder.class);
    WebDataBinder dataBinder = factory.createBinder(webRequest, null, null);

    assertNotNull(dataBinder.getDisallowedFields());
    assertEquals("id", dataBinder.getDisallowedFields()[0]);
  }
View Full Code Here

  @Test
  public void createBinderWithGlobalInitialization() throws Exception {
    ConversionService conversionService = new DefaultFormattingConversionService();
    bindingInitializer.setConversionService(conversionService);

    WebDataBinderFactory factory = createBinderFactory("initBinder", WebDataBinder.class);
    WebDataBinder dataBinder = factory.createBinder(webRequest, null, null);

    assertSame(conversionService, dataBinder.getConversionService());
  }
View Full Code Here

    assertSame(conversionService, dataBinder.getConversionService());
  }

  @Test
  public void createBinderWithAttrName() throws Exception {
    WebDataBinderFactory factory = createBinderFactory("initBinderWithAttributeName", WebDataBinder.class);
    WebDataBinder dataBinder = factory.createBinder(webRequest, null, "foo");

    assertNotNull(dataBinder.getDisallowedFields());
    assertEquals("id", dataBinder.getDisallowedFields()[0]);
  }
View Full Code Here

    assertEquals("id", dataBinder.getDisallowedFields()[0]);
  }

  @Test
  public void createBinderWithAttrNameNoMatch() throws Exception {
    WebDataBinderFactory factory = createBinderFactory("initBinderWithAttributeName", WebDataBinder.class);
    WebDataBinder dataBinder = factory.createBinder(webRequest, null, "invalidName");

    assertNull(dataBinder.getDisallowedFields());
  }
View Full Code Here

    assertNull(dataBinder.getDisallowedFields());
  }

  @Test
  public void createBinderNullAttrName() throws Exception {
    WebDataBinderFactory factory = createBinderFactory("initBinderWithAttributeName", WebDataBinder.class);
    WebDataBinder dataBinder = factory.createBinder(webRequest, null, null);

    assertNull(dataBinder.getDisallowedFields());
  }
View Full Code Here

    assertNull(dataBinder.getDisallowedFields());
  }

  @Test(expected=IllegalStateException.class)
  public void returnValueNotExpected() throws Exception {
    WebDataBinderFactory factory = createBinderFactory("initBinderReturnValue", WebDataBinder.class);
    factory.createBinder(webRequest, null, "invalidName");
  }
View Full Code Here

  @Test
  public void createBinderTypeConversion() throws Exception {
    webRequest.getNativeRequest(MockHttpServletRequest.class).setParameter("requestParam", "22");
    argumentResolvers.addResolver(new RequestParamMethodArgumentResolver(null, false));

    WebDataBinderFactory factory = createBinderFactory("initBinderTypeConversion", WebDataBinder.class, int.class);
    WebDataBinder dataBinder = factory.createBinder(webRequest, null, "foo");

    assertNotNull(dataBinder.getDisallowedFields());
    assertEquals("requestParam-22", dataBinder.getDisallowedFields()[0]);
  }
View Full Code Here

TOP

Related Classes of org.springframework.web.bind.support.WebDataBinderFactory

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.