org.springframework.web.method.support.HandlerMethodArgumentResolverComposite Java Examples
The following examples show how to use
org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NotificationHandlerMethodArgumentResolverFactoryBeanTest.java From spring-cloud-aws with Apache License 2.0 | 6 votes |
@Test void getObject_withDefaultConfiguration_createCompositeResolverWithAllDelegatedResolvers() throws Exception { // Arrange AmazonSNS amazonSns = mock(AmazonSNS.class); NotificationHandlerMethodArgumentResolverFactoryBean factoryBean; factoryBean = new NotificationHandlerMethodArgumentResolverFactoryBean(amazonSns); factoryBean.afterPropertiesSet(); // Act HandlerMethodArgumentResolver argumentResolver = factoryBean.getObject(); // Assert assertThat(argumentResolver).isNotNull(); assertThat(((HandlerMethodArgumentResolverComposite) argumentResolver) .getResolvers().size()).isEqualTo(3); }
Example #2
Source File: ModelFactoryOrderingTests.java From java-technology-stack with MIT License | 5 votes |
private void runTest(Object controller) throws Exception { HandlerMethodArgumentResolverComposite resolvers = new HandlerMethodArgumentResolverComposite(); resolvers.addResolver(new ModelAttributeMethodProcessor(false)); resolvers.addResolver(new ModelMethodProcessor()); WebDataBinderFactory dataBinderFactory = new DefaultDataBinderFactory(null); Class<?> type = controller.getClass(); Set<Method> methods = MethodIntrospector.selectMethods(type, METHOD_FILTER); List<InvocableHandlerMethod> modelMethods = new ArrayList<>(); for (Method method : methods) { InvocableHandlerMethod modelMethod = new InvocableHandlerMethod(controller, method); modelMethod.setHandlerMethodArgumentResolvers(resolvers); modelMethod.setDataBinderFactory(dataBinderFactory); modelMethods.add(modelMethod); } Collections.shuffle(modelMethods); SessionAttributesHandler sessionHandler = new SessionAttributesHandler(type, this.sessionAttributeStore); ModelFactory factory = new ModelFactory(modelMethods, dataBinderFactory, sessionHandler); factory.initModel(this.webRequest, this.mavContainer, new HandlerMethod(controller, "handle")); if (logger.isDebugEnabled()) { StringBuilder sb = new StringBuilder(); for (String name : getInvokedMethods()) { sb.append(" >> ").append(name); } logger.debug(sb); } }
Example #3
Source File: ModelFactoryOrderingTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
private void runTest(Object controller) throws Exception { HandlerMethodArgumentResolverComposite resolvers = new HandlerMethodArgumentResolverComposite(); resolvers.addResolver(new ModelAttributeMethodProcessor(false)); resolvers.addResolver(new ModelMethodProcessor()); WebDataBinderFactory dataBinderFactory = new DefaultDataBinderFactory(null); Class<?> type = controller.getClass(); Set<Method> methods = MethodIntrospector.selectMethods(type, METHOD_FILTER); List<InvocableHandlerMethod> modelMethods = new ArrayList<InvocableHandlerMethod>(); for (Method method : methods) { InvocableHandlerMethod modelMethod = new InvocableHandlerMethod(controller, method); modelMethod.setHandlerMethodArgumentResolvers(resolvers); modelMethod.setDataBinderFactory(dataBinderFactory); modelMethods.add(modelMethod); } Collections.shuffle(modelMethods); SessionAttributesHandler sessionHandler = new SessionAttributesHandler(type, this.sessionAttributeStore); ModelFactory factory = new ModelFactory(modelMethods, dataBinderFactory, sessionHandler); factory.initModel(this.webRequest, this.mavContainer, new HandlerMethod(controller, "handle")); if (logger.isDebugEnabled()) { StringBuilder sb = new StringBuilder(); for (String name : getInvokedMethods()) { sb.append(" >> ").append(name); } logger.debug(sb); } }
Example #4
Source File: ModelFactoryTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
private ModelFactory createModelFactory(String methodName, Class<?>... parameterTypes) throws Exception{ Method method = TestController.class.getMethod(methodName, parameterTypes); HandlerMethodArgumentResolverComposite argResolvers = new HandlerMethodArgumentResolverComposite(); argResolvers.addResolver(new ModelMethodProcessor()); InvocableHandlerMethod handlerMethod = new InvocableHandlerMethod(this.controller, method); handlerMethod.setHandlerMethodArgumentResolvers(argResolvers); handlerMethod.setDataBinderFactory(null); handlerMethod.setParameterNameDiscoverer(new LocalVariableTableParameterNameDiscoverer()); return new ModelFactory(Arrays.asList(handlerMethod), null, this.sessionAttrsHandler); }
Example #5
Source File: RequestMappingHandlerAdapter.java From spring4-understanding with Apache License 2.0 | 5 votes |
/** * Configure the supported argument types in {@code @InitBinder} methods. */ public void setInitBinderArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) { if (argumentResolvers == null) { this.initBinderArgumentResolvers = null; } else { this.initBinderArgumentResolvers = new HandlerMethodArgumentResolverComposite(); this.initBinderArgumentResolvers.addResolvers(argumentResolvers); } }
Example #6
Source File: RequestMappingHandlerAdapter.java From spring4-understanding with Apache License 2.0 | 5 votes |
/** * Configure the complete list of supported argument types thus overriding * the resolvers that would otherwise be configured by default. */ public void setArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) { if (argumentResolvers == null) { this.argumentResolvers = null; } else { this.argumentResolvers = new HandlerMethodArgumentResolverComposite(); this.argumentResolvers.addResolvers(argumentResolvers); } }
Example #7
Source File: ExceptionHandlerExceptionResolver.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override public void afterPropertiesSet() { // Do this first, it may add ResponseBodyAdvice beans initExceptionHandlerAdviceCache(); if (this.argumentResolvers == null) { List<HandlerMethodArgumentResolver> resolvers = getDefaultArgumentResolvers(); this.argumentResolvers = new HandlerMethodArgumentResolverComposite().addResolvers(resolvers); } if (this.returnValueHandlers == null) { List<HandlerMethodReturnValueHandler> handlers = getDefaultReturnValueHandlers(); this.returnValueHandlers = new HandlerMethodReturnValueHandlerComposite().addHandlers(handlers); } }
Example #8
Source File: SpringParameterProvider.java From katharsis-framework with Apache License 2.0 | 5 votes |
public SpringParameterProvider(ConfigurableBeanFactory beanFactory, HttpServletRequest request) { this.request = request; this.beanFactory = beanFactory; List<HttpMessageConverter<?>> messageConverters = getHttpMessageConverters(); argumentResolvers = new HandlerMethodArgumentResolverComposite() .addResolvers(getArgumentResolvers(messageConverters)); }
Example #9
Source File: ExceptionHandlerExceptionResolver.java From spring4-understanding with Apache License 2.0 | 5 votes |
/** * Configure the complete list of supported argument types thus overriding * the resolvers that would otherwise be configured by default. */ public void setArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) { if (argumentResolvers == null) { this.argumentResolvers = null; } else { this.argumentResolvers = new HandlerMethodArgumentResolverComposite(); this.argumentResolvers.addResolvers(argumentResolvers); } }
Example #10
Source File: RequestMappingHandlerAdapter.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Configure the supported argument types in {@code @InitBinder} methods. */ public void setInitBinderArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) { if (argumentResolvers == null) { this.initBinderArgumentResolvers = null; } else { this.initBinderArgumentResolvers = new HandlerMethodArgumentResolverComposite(); this.initBinderArgumentResolvers.addResolvers(argumentResolvers); } }
Example #11
Source File: RequestMappingHandlerAdapter.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Configure the complete list of supported argument types thus overriding * the resolvers that would otherwise be configured by default. */ public void setArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) { if (argumentResolvers == null) { this.argumentResolvers = null; } else { this.argumentResolvers = new HandlerMethodArgumentResolverComposite(); this.argumentResolvers.addResolvers(argumentResolvers); } }
Example #12
Source File: ExceptionHandlerExceptionResolver.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public void afterPropertiesSet() { // Do this first, it may add ResponseBodyAdvice beans initExceptionHandlerAdviceCache(); if (this.argumentResolvers == null) { List<HandlerMethodArgumentResolver> resolvers = getDefaultArgumentResolvers(); this.argumentResolvers = new HandlerMethodArgumentResolverComposite().addResolvers(resolvers); } if (this.returnValueHandlers == null) { List<HandlerMethodReturnValueHandler> handlers = getDefaultReturnValueHandlers(); this.returnValueHandlers = new HandlerMethodReturnValueHandlerComposite().addHandlers(handlers); } }
Example #13
Source File: NotificationHandlerMethodArgumentResolverConfigurationUtils.java From spring-cloud-aws with Apache License 2.0 | 5 votes |
public static HandlerMethodArgumentResolver getNotificationHandlerMethodArgumentResolver( AmazonSNS amazonSns) { HandlerMethodArgumentResolverComposite composite = new HandlerMethodArgumentResolverComposite(); composite.addResolver( new NotificationStatusHandlerMethodArgumentResolver(amazonSns)); composite.addResolver(new NotificationMessageHandlerMethodArgumentResolver()); composite.addResolver(new NotificationSubjectHandlerMethodArgumentResolver()); return composite; }
Example #14
Source File: ExceptionHandlerExceptionResolver.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Configure the complete list of supported argument types thus overriding * the resolvers that would otherwise be configured by default. */ public void setArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) { if (argumentResolvers == null) { this.argumentResolvers = null; } else { this.argumentResolvers = new HandlerMethodArgumentResolverComposite(); this.argumentResolvers.addResolvers(argumentResolvers); } }
Example #15
Source File: ModelFactoryTests.java From java-technology-stack with MIT License | 5 votes |
private ModelFactory createModelFactory(String methodName, Class<?>... parameterTypes) throws Exception { HandlerMethodArgumentResolverComposite resolvers = new HandlerMethodArgumentResolverComposite(); resolvers.addResolver(new ModelMethodProcessor()); InvocableHandlerMethod modelMethod = createHandlerMethod(methodName, parameterTypes); modelMethod.setHandlerMethodArgumentResolvers(resolvers); modelMethod.setDataBinderFactory(null); modelMethod.setParameterNameDiscoverer(new LocalVariableTableParameterNameDiscoverer()); return new ModelFactory(Collections.singletonList(modelMethod), null, this.attributeHandler); }
Example #16
Source File: RequestMappingHandlerAdapter.java From java-technology-stack with MIT License | 5 votes |
/** * Configure the supported argument types in {@code @InitBinder} methods. */ public void setInitBinderArgumentResolvers(@Nullable List<HandlerMethodArgumentResolver> argumentResolvers) { if (argumentResolvers == null) { this.initBinderArgumentResolvers = null; } else { this.initBinderArgumentResolvers = new HandlerMethodArgumentResolverComposite(); this.initBinderArgumentResolvers.addResolvers(argumentResolvers); } }
Example #17
Source File: RequestMappingHandlerAdapter.java From java-technology-stack with MIT License | 5 votes |
/** * Configure the complete list of supported argument types thus overriding * the resolvers that would otherwise be configured by default. */ public void setArgumentResolvers(@Nullable List<HandlerMethodArgumentResolver> argumentResolvers) { if (argumentResolvers == null) { this.argumentResolvers = null; } else { this.argumentResolvers = new HandlerMethodArgumentResolverComposite(); this.argumentResolvers.addResolvers(argumentResolvers); } }
Example #18
Source File: ExceptionHandlerExceptionResolver.java From java-technology-stack with MIT License | 5 votes |
@Override public void afterPropertiesSet() { // Do this first, it may add ResponseBodyAdvice beans initExceptionHandlerAdviceCache(); if (this.argumentResolvers == null) { List<HandlerMethodArgumentResolver> resolvers = getDefaultArgumentResolvers(); this.argumentResolvers = new HandlerMethodArgumentResolverComposite().addResolvers(resolvers); } if (this.returnValueHandlers == null) { List<HandlerMethodReturnValueHandler> handlers = getDefaultReturnValueHandlers(); this.returnValueHandlers = new HandlerMethodReturnValueHandlerComposite().addHandlers(handlers); } }
Example #19
Source File: ExceptionHandlerExceptionResolver.java From java-technology-stack with MIT License | 5 votes |
/** * Configure the complete list of supported argument types thus overriding * the resolvers that would otherwise be configured by default. */ public void setArgumentResolvers(@Nullable List<HandlerMethodArgumentResolver> argumentResolvers) { if (argumentResolvers == null) { this.argumentResolvers = null; } else { this.argumentResolvers = new HandlerMethodArgumentResolverComposite(); this.argumentResolvers.addResolvers(argumentResolvers); } }
Example #20
Source File: ModelFactoryOrderingTests.java From spring-analysis-note with MIT License | 5 votes |
private void runTest(Object controller) throws Exception { HandlerMethodArgumentResolverComposite resolvers = new HandlerMethodArgumentResolverComposite(); resolvers.addResolver(new ModelAttributeMethodProcessor(false)); resolvers.addResolver(new ModelMethodProcessor()); WebDataBinderFactory dataBinderFactory = new DefaultDataBinderFactory(null); Class<?> type = controller.getClass(); Set<Method> methods = MethodIntrospector.selectMethods(type, METHOD_FILTER); List<InvocableHandlerMethod> modelMethods = new ArrayList<>(); for (Method method : methods) { InvocableHandlerMethod modelMethod = new InvocableHandlerMethod(controller, method); modelMethod.setHandlerMethodArgumentResolvers(resolvers); modelMethod.setDataBinderFactory(dataBinderFactory); modelMethods.add(modelMethod); } Collections.shuffle(modelMethods); SessionAttributesHandler sessionHandler = new SessionAttributesHandler(type, this.sessionAttributeStore); ModelFactory factory = new ModelFactory(modelMethods, dataBinderFactory, sessionHandler); factory.initModel(this.webRequest, this.mavContainer, new HandlerMethod(controller, "handle")); if (logger.isDebugEnabled()) { StringBuilder sb = new StringBuilder(); for (String name : getInvokedMethods()) { sb.append(" >> ").append(name); } logger.debug(sb); } }
Example #21
Source File: ModelFactoryTests.java From spring-analysis-note with MIT License | 5 votes |
private ModelFactory createModelFactory(String methodName, Class<?>... parameterTypes) throws Exception { HandlerMethodArgumentResolverComposite resolvers = new HandlerMethodArgumentResolverComposite(); resolvers.addResolver(new ModelMethodProcessor()); InvocableHandlerMethod modelMethod = createHandlerMethod(methodName, parameterTypes); modelMethod.setHandlerMethodArgumentResolvers(resolvers); modelMethod.setDataBinderFactory(null); modelMethod.setParameterNameDiscoverer(new LocalVariableTableParameterNameDiscoverer()); return new ModelFactory(Collections.singletonList(modelMethod), null, this.attributeHandler); }
Example #22
Source File: RequestMappingHandlerAdapter.java From spring-analysis-note with MIT License | 5 votes |
/** * Configure the supported argument types in {@code @InitBinder} methods. */ public void setInitBinderArgumentResolvers(@Nullable List<HandlerMethodArgumentResolver> argumentResolvers) { if (argumentResolvers == null) { this.initBinderArgumentResolvers = null; } else { this.initBinderArgumentResolvers = new HandlerMethodArgumentResolverComposite(); this.initBinderArgumentResolvers.addResolvers(argumentResolvers); } }
Example #23
Source File: RequestMappingHandlerAdapter.java From spring-analysis-note with MIT License | 5 votes |
/** * Configure the complete list of supported argument types thus overriding * the resolvers that would otherwise be configured by default. */ public void setArgumentResolvers(@Nullable List<HandlerMethodArgumentResolver> argumentResolvers) { if (argumentResolvers == null) { this.argumentResolvers = null; } else { this.argumentResolvers = new HandlerMethodArgumentResolverComposite(); this.argumentResolvers.addResolvers(argumentResolvers); } }
Example #24
Source File: ExceptionHandlerExceptionResolver.java From spring-analysis-note with MIT License | 5 votes |
@Override public void afterPropertiesSet() { // Do this first, it may add ResponseBodyAdvice beans initExceptionHandlerAdviceCache(); if (this.argumentResolvers == null) { List<HandlerMethodArgumentResolver> resolvers = getDefaultArgumentResolvers(); this.argumentResolvers = new HandlerMethodArgumentResolverComposite().addResolvers(resolvers); } if (this.returnValueHandlers == null) { List<HandlerMethodReturnValueHandler> handlers = getDefaultReturnValueHandlers(); this.returnValueHandlers = new HandlerMethodReturnValueHandlerComposite().addHandlers(handlers); } }
Example #25
Source File: ExceptionHandlerExceptionResolver.java From spring-analysis-note with MIT License | 5 votes |
/** * Configure the complete list of supported argument types thus overriding * the resolvers that would otherwise be configured by default. */ public void setArgumentResolvers(@Nullable List<HandlerMethodArgumentResolver> argumentResolvers) { if (argumentResolvers == null) { this.argumentResolvers = null; } else { this.argumentResolvers = new HandlerMethodArgumentResolverComposite(); this.argumentResolvers.addResolvers(argumentResolvers); } }
Example #26
Source File: ExceptionHandlerExceptionResolver.java From spring-analysis-note with MIT License | 4 votes |
/** * Return the configured argument resolvers, or possibly {@code null} if * not initialized yet via {@link #afterPropertiesSet()}. */ @Nullable public HandlerMethodArgumentResolverComposite getArgumentResolvers() { return this.argumentResolvers; }
Example #27
Source File: InitBinderDataBinderFactoryTests.java From spring4-understanding with Apache License 2.0 | 4 votes |
@Before public void setUp() throws Exception { bindingInitializer = new ConfigurableWebBindingInitializer(); argumentResolvers = new HandlerMethodArgumentResolverComposite(); webRequest = new ServletWebRequest(new MockHttpServletRequest()); }
Example #28
Source File: ExceptionHandlerExceptionResolver.java From java-technology-stack with MIT License | 4 votes |
/** * Return the configured argument resolvers, or possibly {@code null} if * not initialized yet via {@link #afterPropertiesSet()}. */ @Nullable public HandlerMethodArgumentResolverComposite getArgumentResolvers() { return this.argumentResolvers; }
Example #29
Source File: ExceptionHandlerExceptionResolver.java From spring4-understanding with Apache License 2.0 | 2 votes |
/** * Return the configured argument resolvers, or possibly {@code null} if * not initialized yet via {@link #afterPropertiesSet()}. */ public HandlerMethodArgumentResolverComposite getArgumentResolvers() { return this.argumentResolvers; }
Example #30
Source File: ExceptionHandlerExceptionResolver.java From lams with GNU General Public License v2.0 | 2 votes |
/** * Return the configured argument resolvers, or possibly {@code null} if * not initialized yet via {@link #afterPropertiesSet()}. */ public HandlerMethodArgumentResolverComposite getArgumentResolvers() { return this.argumentResolvers; }