Package org.springframework.web.bind.support

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


  private NativeWebRequest webRequest;

  @Before
  public void setUp() throws Exception {
    bindingInitializer = new ConfigurableWebBindingInitializer();
    argumentResolvers = new HandlerMethodArgumentResolverComposite();
    webRequest = new ServletWebRequest(new MockHttpServletRequest());
  }
View Full Code Here


  public void requestMappingHandlerAdapter() throws Exception {

    delegatingConfig.setConfigurers(Arrays.asList(webMvcConfigurer));
    RequestMappingHandlerAdapter adapter = delegatingConfig.requestMappingHandlerAdapter();

    ConfigurableWebBindingInitializer initializer = (ConfigurableWebBindingInitializer) adapter.getWebBindingInitializer();
    ConversionService initializerConversionService = initializer.getConversionService();
    assertTrue(initializer.getValidator() instanceof LocalValidatorFactoryBean);

    verify(webMvcConfigurer).configureMessageConverters(converters.capture());
    verify(webMvcConfigurer).configureContentNegotiation(contentNegotiationConfigurer.capture());
    verify(webMvcConfigurer).addFormatters(conversionService.capture());
    verify(webMvcConfigurer).addArgumentResolvers(resolvers.capture());
View Full Code Here

    assertEquals("", result);
  }

  @Test
  public void resolveOptional() throws Exception {
    ConfigurableWebBindingInitializer initializer = new ConfigurableWebBindingInitializer();
    initializer.setConversionService(new DefaultConversionService());
    WebDataBinderFactory binderFactory = new DefaultDataBinderFactory(initializer);

    Object result = resolver.resolveArgument(paramOptional, null, webRequest, binderFactory);
    assertEquals(Optional.class, result.getClass());
    assertEquals(Optional.empty(), result);
View Full Code Here

  Spr7839Controller controller = new Spr7839Controller();

  @Before
  public void setUp() {
    ConfigurableWebBindingInitializer binder = new ConfigurableWebBindingInitializer();
    GenericConversionService service = new DefaultConversionService();
    service.addConverter(new Converter<String, NestedBean>() {
      @Override
      public NestedBean convert(String source) {
        return new NestedBean(source);
      }
    });
    binder.setConversionService(service);
    adapter.setWebBindingInitializer(binder);
  }
View Full Code Here

  @Test
  @Deprecated
  public void test() throws Exception {
    AnnotationMethodHandlerAdapter adapter = new AnnotationMethodHandlerAdapter();
    ConfigurableWebBindingInitializer binder = new ConfigurableWebBindingInitializer();
    GenericConversionService service = new DefaultConversionService();
    service.addConverter(new ColorConverter());
    binder.setConversionService(service);
    adapter.setWebBindingInitializer(binder);
    Spr7766Controller controller = new Spr7766Controller();
    MockHttpServletRequest request = new MockHttpServletRequest();
    request.setRequestURI("/colors");
    request.setPathInfo("/colors");
View Full Code Here

   * Return the {@link org.springframework.web.bind.support.ConfigurableWebBindingInitializer} to use for
   * initializing all {@link org.springframework.web.bind.WebDataBinder} instances.
   */
  private ConfigurableWebBindingInitializer getConfigurableWebBindingInitializer() {
    if ( initializer == null ) {
      initializer = new ConfigurableWebBindingInitializer();
      initializer.setConversionService( mvcConversionService() );
      initializer.setValidator( mvcValidator() );
    }

    return initializer;
View Full Code Here

TOP

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

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.