Package org.springframework.web.method.support

Examples of org.springframework.web.method.support.InvocableHandlerMethod


    }
    return new ModelFactory(attrMethods, binderFactory, sessionAttrHandler);
  }

  private InvocableHandlerMethod createModelAttributeMethod(WebDataBinderFactory factory, Object bean, Method method) {
    InvocableHandlerMethod attrMethod = new InvocableHandlerMethod(bean, method);
    attrMethod.setHandlerMethodArgumentResolvers(this.argumentResolvers);
    attrMethod.setParameterNameDiscoverer(this.parameterNameDiscoverer);
    attrMethod.setDataBinderFactory(factory);
    return attrMethod;
  }
View Full Code Here


    }
    return createDataBinderFactory(initBinderMethods);
  }

  private InvocableHandlerMethod createInitBinderMethod(Object bean, Method method) {
    InvocableHandlerMethod binderMethod = new InvocableHandlerMethod(bean, method);
    binderMethod.setHandlerMethodArgumentResolvers(this.initBinderArgumentResolvers);
    binderMethod.setDataBinderFactory(new DefaultDataBinderFactory(this.webBindingInitializer));
    binderMethod.setParameterNameDiscoverer(this.parameterNameDiscoverer);
    return binderMethod;
  }
View Full Code Here

      methods = HandlerMethodSelector.selectMethods(handlerType, MODEL_ATTRIBUTE_METHODS);
      this.modelFactoryCache.put(handlerType, methods);
    }
    List<InvocableHandlerMethod> attrMethods = new ArrayList<InvocableHandlerMethod>();
    for (Method method : methods) {
      InvocableHandlerMethod attrMethod = new InvocableHandlerMethod(handlerMethod.getBean(), method);
      attrMethod.setHandlerMethodArgumentResolvers(this.argumentResolvers);
      attrMethod.setParameterNameDiscoverer(this.parameterNameDiscoverer);
      attrMethod.setDataBinderFactory(binderFactory);
      attrMethods.add(attrMethod);
    }
    return new ModelFactory(attrMethods, binderFactory, sessionAttrHandler);
  }
View Full Code Here

      methods = HandlerMethodSelector.selectMethods(handlerType, INIT_BINDER_METHODS);
      this.dataBinderFactoryCache.put(handlerType, methods);
    }
    List<InvocableHandlerMethod> binderMethods = new ArrayList<InvocableHandlerMethod>();
    for (Method method : methods) {
      InvocableHandlerMethod binderMethod = new InvocableHandlerMethod(handlerMethod.getBean(), method);
      binderMethod.setHandlerMethodArgumentResolvers(this.initBinderArgumentResolvers);
      binderMethod.setDataBinderFactory(new DefaultDataBinderFactory(this.webBindingInitializer));
      binderMethod.setParameterNameDiscoverer(this.parameterNameDiscoverer);
      binderMethods.add(binderMethod);
    }
    return createDataBinderFactory(binderMethods);
  }
View Full Code Here

    }
    return new ModelFactory(attrMethods, binderFactory, sessionAttrHandler);
  }

  private InvocableHandlerMethod createModelAttributeMethod(WebDataBinderFactory factory, Object bean, Method method) {
    InvocableHandlerMethod attrMethod = new InvocableHandlerMethod(bean, method);
    attrMethod.setHandlerMethodArgumentResolvers(this.argumentResolvers);
    attrMethod.setParameterNameDiscoverer(this.parameterNameDiscoverer);
    attrMethod.setDataBinderFactory(factory);
    return attrMethod;
  }
View Full Code Here

    }
    return createDataBinderFactory(initBinderMethods);
  }

  private InvocableHandlerMethod createInitBinderMethod(Object bean, Method method) {
    InvocableHandlerMethod binderMethod = new InvocableHandlerMethod(bean, method);
    binderMethod.setHandlerMethodArgumentResolvers(this.initBinderArgumentResolvers);
    binderMethod.setDataBinderFactory(new DefaultDataBinderFactory(this.webBindingInitializer));
    binderMethod.setParameterNameDiscoverer(this.parameterNameDiscoverer);
    return binderMethod;
  }
View Full Code Here

   */
  private void invokeModelAttributeMethods(NativeWebRequest request, ModelAndViewContainer mavContainer)
      throws Exception {

    while (!this.modelMethods.isEmpty()) {
      InvocableHandlerMethod attrMethod = getNextModelMethod(mavContainer).getHandlerMethod();
      String modelName = attrMethod.getMethodAnnotation(ModelAttribute.class).value();
      if (mavContainer.containsAttribute(modelName)) {
        continue;
      }

      Object returnValue = attrMethod.invokeForRequest(request, mavContainer);

      if (!attrMethod.isVoid()){
        String returnValueName = getNameForReturnValue(returnValue, attrMethod.getReturnType());
        if (!mavContainer.containsAttribute(returnValueName)) {
          mavContainer.addAttribute(returnValueName, returnValue);
        }
      }
    }
View Full Code Here

    String attributeName = WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE;
    appContext.getServletContext().setAttribute(attributeName, appContext);

    handler = new TestController();
    Method method = TestController.class.getMethod("testBind", Date.class, TestBean.class, BindingResult.class);
    handlerMethod = new InvocableHandlerMethod(handler, method);
  }
View Full Code Here

    assertFalse(request.getSession().getAttributeNames().hasMoreElements());
  }

  private HandlerMethod handlerMethod(String methodName, Class<?>... paramTypes) throws Exception {
    Method method = handler.getClass().getDeclaredMethod(methodName, paramTypes);
    return new InvocableHandlerMethod(handler, method);
  }
View Full Code Here

      throws Exception {

    Object handler = new InitBinderHandler();
    Method method = handler.getClass().getMethod(methodName, parameterTypes);

    InvocableHandlerMethod handlerMethod = new InvocableHandlerMethod(handler, method);
    handlerMethod.setHandlerMethodArgumentResolvers(argumentResolvers);
    handlerMethod.setDataBinderFactory(new DefaultDataBinderFactory(null));
    handlerMethod.setParameterNameDiscoverer(new LocalVariableTableParameterNameDiscoverer());

    return new InitBinderDataBinderFactory(Arrays.asList(handlerMethod), bindingInitializer);
  }
View Full Code Here

TOP

Related Classes of org.springframework.web.method.support.InvocableHandlerMethod

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.