@Test public void test_executeControllerMethodShouldDependOnHttpRequestMethod() throws Exception { Map<Class<?>, Object> argumentsByType = new HashMap<Class<?>, Object>(); Object result = UiFrameworkUtil.executeControllerMethod(new MockFormController(), "GET", argumentsByType, conversionService, applicationContext); Assert.assertEquals("Got it", result); result = UiFrameworkUtil.executeControllerMethod(new MockFormController(), "POST", argumentsByType, conversionService, applicationContext); Assert.assertEquals("Posted it", result); result = UiFrameworkUtil.executeControllerMethod(new MockFormController(), "HEAD", argumentsByType, conversionService, applicationContext); Assert.assertEquals("Fallback", result); result = UiFrameworkUtil.executeControllerMethod(new MockFormController(), null, argumentsByType, conversionService, applicationContext); Assert.assertEquals("Fallback", result); }
public static Object executeControllerMethod(Object controller, String httpRequestMethod, Map<Class<?>, Object> possibleArguments, ConversionService conversionService, ApplicationContext applicationContext) throws PageAction { Method controllerMethod = null; controllerMethod = findControllerMethodForHttpRequestMethod(controller, httpRequestMethod); if (controllerMethod == null) { controllerMethod = findGenericControllerMethod(controller); } if (controllerMethod == null) throw new UiFrameworkException("Cannot find controller method for request method " + httpRequestMethod + " in " + controller.getClass()); return invokeMethodWithArguments(controller, controllerMethod, possibleArguments, conversionService, applicationContext); }
UiFrameworkUtil { public static Object executeControllerMethod(Object controller, String httpRequestMethod, Map<Class<?>, Object> possibleArguments, ConversionService conversionService, ApplicationContext applicationContext) throws PageAction { Method controllerMethod = null; controllerMethod = findControllerMethodForHttpRequestMethod(controller, httpRequestMethod); if (controllerMethod == null) { controllerMethod = findGenericControllerMethod(controller); } if (controllerMethod == null) throw new UiFrameworkException("Cannot find controller method for request method " + httpRequestMethod + " in " + controller.getClass()); return invokeMethodWithArguments(controller, controllerMethod, possibleArguments, conversionService, applicationContext); } }
UiFrameworkUtil { public static Object executeControllerMethod(Object controller, String httpRequestMethod, Map<Class<?>, Object> possibleArguments, ConversionService conversionService, ApplicationContext applicationContext) throws PageAction { Method controllerMethod = null; controllerMethod = findControllerMethodForHttpRequestMethod(controller, httpRequestMethod); if (controllerMethod == null) { controllerMethod = findGenericControllerMethod(controller); } if (controllerMethod == null) throw new UiFrameworkException("Cannot find controller method for request method " + httpRequestMethod + " in " + controller.getClass()); return invokeMethodWithArguments(controller, controllerMethod, possibleArguments, conversionService, applicationContext); }  }
UiFrameworkUtil { public static Object executeControllerMethod(Object controller, String httpRequestMethod, Map<Class<?>, Object> possibleArguments, ConversionService conversionService, ApplicationContext applicationContext) throws PageAction { Method controllerMethod = null; controllerMethod = findControllerMethodForHttpRequestMethod(controller, httpRequestMethod); if (controllerMethod == null) { controllerMethod = findGenericControllerMethod(controller); } if (controllerMethod == null) throw new UiFrameworkException("Cannot find controller method for request method " + httpRequestMethod + " in " + controller.getClass()); return invokeMethodWithArguments(controller, controllerMethod, possibleArguments, conversionService, applicationContext); }  static Object executeControllerMethod(Object controller, String httpRequestMethod, Map<Class<?>, Object> possibleArguments,
                                                 ConversionService conversionService, ApplicationContext applicationContext); static Object invokeMethodWithArguments(Object target, Method method, Map<Class<?>, Object> possibleArguments,
                                                   ConversionService conversionService, ApplicationContext applicationContext); static Object[] determineControllerMethodParameters(Object controller, Method method, Map<Class<?>, Object> argumentsByType,
                                                               ConversionService conversionService, ApplicationContext applicationContext); static Object determineArgumentValue(Object controller, Map<Class<?>, Object> valuesByType, MethodParameter methodParam,
                                                ConversionService conversionService, ApplicationContext applicationContext); @SuppressWarnings("unchecked") static T findCause(Throwable t, Class<T> lookFor); static String getMessage(MessageSourceResolvable msg); static boolean checkAndSetDevelopmentModeForProvider(String key, Object provider); static DateFormat getDateFormat(AdministrationService administrationService, Locale locale); static DateFormat getDateTimeFormat(AdministrationService administrationService, Locale locale); static DateFormat getTimeFormat(AdministrationService administrationService, Locale locale); }
UiFrameworkUtil { public static Object executeControllerMethod(Object controller, String httpRequestMethod, Map<Class<?>, Object> possibleArguments, ConversionService conversionService, ApplicationContext applicationContext) throws PageAction { Method controllerMethod = null; controllerMethod = findControllerMethodForHttpRequestMethod(controller, httpRequestMethod); if (controllerMethod == null) { controllerMethod = findGenericControllerMethod(controller); } if (controllerMethod == null) throw new UiFrameworkException("Cannot find controller method for request method " + httpRequestMethod + " in " + controller.getClass()); return invokeMethodWithArguments(controller, controllerMethod, possibleArguments, conversionService, applicationContext); }  static Object executeControllerMethod(Object controller, String httpRequestMethod, Map<Class<?>, Object> possibleArguments,
                                                 ConversionService conversionService, ApplicationContext applicationContext); static Object invokeMethodWithArguments(Object target, Method method, Map<Class<?>, Object> possibleArguments,
                                                   ConversionService conversionService, ApplicationContext applicationContext); static Object[] determineControllerMethodParameters(Object controller, Method method, Map<Class<?>, Object> argumentsByType,
                                                               ConversionService conversionService, ApplicationContext applicationContext); static Object determineArgumentValue(Object controller, Map<Class<?>, Object> valuesByType, MethodParameter methodParam,
                                                ConversionService conversionService, ApplicationContext applicationContext); @SuppressWarnings("unchecked") static T findCause(Throwable t, Class<T> lookFor); static String getMessage(MessageSourceResolvable msg); static boolean checkAndSetDevelopmentModeForProvider(String key, Object provider); static DateFormat getDateFormat(AdministrationService administrationService, Locale locale); static DateFormat getDateTimeFormat(AdministrationService administrationService, Locale locale); static DateFormat getTimeFormat(AdministrationService administrationService, Locale locale);  }