Search in sources :

Example 1 with ExpressionValueMethodArgumentResolver

use of org.springframework.web.method.annotation.ExpressionValueMethodArgumentResolver in project spring-framework by spring-projects.

the class RequestMappingHandlerAdapter method getDefaultInitBinderArgumentResolvers.

/**
 * Return the list of argument resolvers to use for {@code @InitBinder}
 * methods including built-in and custom resolvers.
 */
private List<HandlerMethodArgumentResolver> getDefaultInitBinderArgumentResolvers() {
    List<HandlerMethodArgumentResolver> resolvers = new ArrayList<>(20);
    // Annotation-based argument resolution
    resolvers.add(new RequestParamMethodArgumentResolver(getBeanFactory(), false));
    resolvers.add(new RequestParamMapMethodArgumentResolver());
    resolvers.add(new PathVariableMethodArgumentResolver());
    resolvers.add(new PathVariableMapMethodArgumentResolver());
    resolvers.add(new MatrixVariableMethodArgumentResolver());
    resolvers.add(new MatrixVariableMapMethodArgumentResolver());
    resolvers.add(new ExpressionValueMethodArgumentResolver(getBeanFactory()));
    resolvers.add(new SessionAttributeMethodArgumentResolver());
    resolvers.add(new RequestAttributeMethodArgumentResolver());
    // Type-based argument resolution
    resolvers.add(new ServletRequestMethodArgumentResolver());
    resolvers.add(new ServletResponseMethodArgumentResolver());
    // Custom arguments
    if (getCustomArgumentResolvers() != null) {
        resolvers.addAll(getCustomArgumentResolvers());
    }
    // Catch-all
    resolvers.add(new PrincipalMethodArgumentResolver());
    resolvers.add(new RequestParamMethodArgumentResolver(getBeanFactory(), true));
    return resolvers;
}
Also used : RequestParamMethodArgumentResolver(org.springframework.web.method.annotation.RequestParamMethodArgumentResolver) ExpressionValueMethodArgumentResolver(org.springframework.web.method.annotation.ExpressionValueMethodArgumentResolver) ArrayList(java.util.ArrayList) HandlerMethodArgumentResolver(org.springframework.web.method.support.HandlerMethodArgumentResolver) RequestParamMapMethodArgumentResolver(org.springframework.web.method.annotation.RequestParamMapMethodArgumentResolver)

Example 2 with ExpressionValueMethodArgumentResolver

use of org.springframework.web.method.annotation.ExpressionValueMethodArgumentResolver in project spring-framework by spring-projects.

the class RequestMappingHandlerAdapter method getDefaultArgumentResolvers.

/**
 * Return the list of argument resolvers to use including built-in resolvers
 * and custom resolvers provided via {@link #setCustomArgumentResolvers}.
 */
private List<HandlerMethodArgumentResolver> getDefaultArgumentResolvers() {
    List<HandlerMethodArgumentResolver> resolvers = new ArrayList<>(30);
    // Annotation-based argument resolution
    resolvers.add(new RequestParamMethodArgumentResolver(getBeanFactory(), false));
    resolvers.add(new RequestParamMapMethodArgumentResolver());
    resolvers.add(new PathVariableMethodArgumentResolver());
    resolvers.add(new PathVariableMapMethodArgumentResolver());
    resolvers.add(new MatrixVariableMethodArgumentResolver());
    resolvers.add(new MatrixVariableMapMethodArgumentResolver());
    resolvers.add(new ServletModelAttributeMethodProcessor(false));
    resolvers.add(new RequestResponseBodyMethodProcessor(getMessageConverters(), this.requestResponseBodyAdvice));
    resolvers.add(new RequestPartMethodArgumentResolver(getMessageConverters(), this.requestResponseBodyAdvice));
    resolvers.add(new RequestHeaderMethodArgumentResolver(getBeanFactory()));
    resolvers.add(new RequestHeaderMapMethodArgumentResolver());
    resolvers.add(new ServletCookieValueMethodArgumentResolver(getBeanFactory()));
    resolvers.add(new ExpressionValueMethodArgumentResolver(getBeanFactory()));
    resolvers.add(new SessionAttributeMethodArgumentResolver());
    resolvers.add(new RequestAttributeMethodArgumentResolver());
    // Type-based argument resolution
    resolvers.add(new ServletRequestMethodArgumentResolver());
    resolvers.add(new ServletResponseMethodArgumentResolver());
    resolvers.add(new HttpEntityMethodProcessor(getMessageConverters(), this.requestResponseBodyAdvice));
    resolvers.add(new RedirectAttributesMethodArgumentResolver());
    resolvers.add(new ModelMethodProcessor());
    resolvers.add(new MapMethodProcessor());
    resolvers.add(new ErrorsMethodArgumentResolver());
    resolvers.add(new SessionStatusMethodArgumentResolver());
    resolvers.add(new UriComponentsBuilderMethodArgumentResolver());
    if (KotlinDetector.isKotlinPresent()) {
        resolvers.add(new ContinuationHandlerMethodArgumentResolver());
    }
    // Custom arguments
    if (getCustomArgumentResolvers() != null) {
        resolvers.addAll(getCustomArgumentResolvers());
    }
    // Catch-all
    resolvers.add(new PrincipalMethodArgumentResolver());
    resolvers.add(new RequestParamMethodArgumentResolver(getBeanFactory(), true));
    resolvers.add(new ServletModelAttributeMethodProcessor(true));
    return resolvers;
}
Also used : RequestParamMethodArgumentResolver(org.springframework.web.method.annotation.RequestParamMethodArgumentResolver) ModelMethodProcessor(org.springframework.web.method.annotation.ModelMethodProcessor) ArrayList(java.util.ArrayList) SessionStatusMethodArgumentResolver(org.springframework.web.method.annotation.SessionStatusMethodArgumentResolver) ExpressionValueMethodArgumentResolver(org.springframework.web.method.annotation.ExpressionValueMethodArgumentResolver) ErrorsMethodArgumentResolver(org.springframework.web.method.annotation.ErrorsMethodArgumentResolver) HandlerMethodArgumentResolver(org.springframework.web.method.support.HandlerMethodArgumentResolver) RequestParamMapMethodArgumentResolver(org.springframework.web.method.annotation.RequestParamMapMethodArgumentResolver) RequestHeaderMethodArgumentResolver(org.springframework.web.method.annotation.RequestHeaderMethodArgumentResolver) MapMethodProcessor(org.springframework.web.method.annotation.MapMethodProcessor) RequestHeaderMapMethodArgumentResolver(org.springframework.web.method.annotation.RequestHeaderMapMethodArgumentResolver)

Example 3 with ExpressionValueMethodArgumentResolver

use of org.springframework.web.method.annotation.ExpressionValueMethodArgumentResolver in project crnk-framework by crnk-project.

the class SpringParameterProvider method getArgumentResolvers.

private List<HandlerMethodArgumentResolver> getArgumentResolvers(List<HttpMessageConverter<?>> messageConverters) {
    List<HandlerMethodArgumentResolver> resolvers = new LinkedList<>();
    resolvers.add(new RequestParamMethodArgumentResolver(beanFactory, false));
    resolvers.add(new RequestParamMapMethodArgumentResolver());
    resolvers.add(new MatrixVariableMethodArgumentResolver());
    resolvers.add(new MatrixVariableMapMethodArgumentResolver());
    resolvers.add(new ServletModelAttributeMethodProcessor(false));
    resolvers.add(new RequestResponseBodyMethodProcessor(messageConverters));
    resolvers.add(new RequestPartMethodArgumentResolver(messageConverters));
    resolvers.add(new RequestHeaderMethodArgumentResolver(beanFactory));
    resolvers.add(new RequestHeaderMapMethodArgumentResolver());
    resolvers.add(new ServletCookieValueMethodArgumentResolver(beanFactory));
    resolvers.add(new ExpressionValueMethodArgumentResolver(beanFactory));
    resolvers.add(new ServletRequestMethodArgumentResolver());
    resolvers.add(new ServletResponseMethodArgumentResolver());
    resolvers.add(new HttpEntityMethodProcessor(messageConverters));
    resolvers.add(new RedirectAttributesMethodArgumentResolver());
    resolvers.add(new ModelMethodProcessor());
    resolvers.add(new MapMethodProcessor());
    resolvers.add(new ErrorsMethodArgumentResolver());
    resolvers.add(new SessionStatusMethodArgumentResolver());
    resolvers.add(new UriComponentsBuilderMethodArgumentResolver());
    resolvers.add(new RequestParamMethodArgumentResolver(beanFactory, true));
    resolvers.add(new ServletModelAttributeMethodProcessor(true));
    return resolvers;
}
Also used : RequestParamMethodArgumentResolver(org.springframework.web.method.annotation.RequestParamMethodArgumentResolver) ServletCookieValueMethodArgumentResolver(org.springframework.web.servlet.mvc.method.annotation.ServletCookieValueMethodArgumentResolver) ExpressionValueMethodArgumentResolver(org.springframework.web.method.annotation.ExpressionValueMethodArgumentResolver) MatrixVariableMapMethodArgumentResolver(org.springframework.web.servlet.mvc.method.annotation.MatrixVariableMapMethodArgumentResolver) ModelMethodProcessor(org.springframework.web.method.annotation.ModelMethodProcessor) ErrorsMethodArgumentResolver(org.springframework.web.method.annotation.ErrorsMethodArgumentResolver) ServletModelAttributeMethodProcessor(org.springframework.web.servlet.mvc.method.annotation.ServletModelAttributeMethodProcessor) RedirectAttributesMethodArgumentResolver(org.springframework.web.servlet.mvc.method.annotation.RedirectAttributesMethodArgumentResolver) UriComponentsBuilderMethodArgumentResolver(org.springframework.web.servlet.mvc.method.annotation.UriComponentsBuilderMethodArgumentResolver) HandlerMethodArgumentResolver(org.springframework.web.method.support.HandlerMethodArgumentResolver) ServletResponseMethodArgumentResolver(org.springframework.web.servlet.mvc.method.annotation.ServletResponseMethodArgumentResolver) LinkedList(java.util.LinkedList) RequestParamMapMethodArgumentResolver(org.springframework.web.method.annotation.RequestParamMapMethodArgumentResolver) RequestHeaderMethodArgumentResolver(org.springframework.web.method.annotation.RequestHeaderMethodArgumentResolver) HttpEntityMethodProcessor(org.springframework.web.servlet.mvc.method.annotation.HttpEntityMethodProcessor) MatrixVariableMethodArgumentResolver(org.springframework.web.servlet.mvc.method.annotation.MatrixVariableMethodArgumentResolver) MapMethodProcessor(org.springframework.web.method.annotation.MapMethodProcessor) RequestHeaderMapMethodArgumentResolver(org.springframework.web.method.annotation.RequestHeaderMapMethodArgumentResolver) ServletRequestMethodArgumentResolver(org.springframework.web.servlet.mvc.method.annotation.ServletRequestMethodArgumentResolver) SessionStatusMethodArgumentResolver(org.springframework.web.method.annotation.SessionStatusMethodArgumentResolver) RequestPartMethodArgumentResolver(org.springframework.web.servlet.mvc.method.annotation.RequestPartMethodArgumentResolver) RequestResponseBodyMethodProcessor(org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor)

Aggregations

ExpressionValueMethodArgumentResolver (org.springframework.web.method.annotation.ExpressionValueMethodArgumentResolver)3 RequestParamMapMethodArgumentResolver (org.springframework.web.method.annotation.RequestParamMapMethodArgumentResolver)3 RequestParamMethodArgumentResolver (org.springframework.web.method.annotation.RequestParamMethodArgumentResolver)3 HandlerMethodArgumentResolver (org.springframework.web.method.support.HandlerMethodArgumentResolver)3 ArrayList (java.util.ArrayList)2 ErrorsMethodArgumentResolver (org.springframework.web.method.annotation.ErrorsMethodArgumentResolver)2 MapMethodProcessor (org.springframework.web.method.annotation.MapMethodProcessor)2 ModelMethodProcessor (org.springframework.web.method.annotation.ModelMethodProcessor)2 RequestHeaderMapMethodArgumentResolver (org.springframework.web.method.annotation.RequestHeaderMapMethodArgumentResolver)2 RequestHeaderMethodArgumentResolver (org.springframework.web.method.annotation.RequestHeaderMethodArgumentResolver)2 SessionStatusMethodArgumentResolver (org.springframework.web.method.annotation.SessionStatusMethodArgumentResolver)2 LinkedList (java.util.LinkedList)1 HttpEntityMethodProcessor (org.springframework.web.servlet.mvc.method.annotation.HttpEntityMethodProcessor)1 MatrixVariableMapMethodArgumentResolver (org.springframework.web.servlet.mvc.method.annotation.MatrixVariableMapMethodArgumentResolver)1 MatrixVariableMethodArgumentResolver (org.springframework.web.servlet.mvc.method.annotation.MatrixVariableMethodArgumentResolver)1 RedirectAttributesMethodArgumentResolver (org.springframework.web.servlet.mvc.method.annotation.RedirectAttributesMethodArgumentResolver)1 RequestPartMethodArgumentResolver (org.springframework.web.servlet.mvc.method.annotation.RequestPartMethodArgumentResolver)1 RequestResponseBodyMethodProcessor (org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor)1 ServletCookieValueMethodArgumentResolver (org.springframework.web.servlet.mvc.method.annotation.ServletCookieValueMethodArgumentResolver)1 ServletModelAttributeMethodProcessor (org.springframework.web.servlet.mvc.method.annotation.ServletModelAttributeMethodProcessor)1