1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.web.controller;
17
18 import org.kuali.rice.krad.web.bind.UifServletRequestDataBinderFactory;
19 import org.springframework.web.method.annotation.ErrorsMethodArgumentResolver;
20 import org.springframework.web.method.annotation.ExpressionValueMethodArgumentResolver;
21 import org.springframework.web.method.annotation.MapMethodProcessor;
22 import org.springframework.web.method.annotation.ModelMethodProcessor;
23 import org.springframework.web.method.annotation.RequestHeaderMapMethodArgumentResolver;
24 import org.springframework.web.method.annotation.RequestHeaderMethodArgumentResolver;
25 import org.springframework.web.method.annotation.RequestParamMapMethodArgumentResolver;
26 import org.springframework.web.method.annotation.RequestParamMethodArgumentResolver;
27 import org.springframework.web.method.annotation.SessionStatusMethodArgumentResolver;
28 import org.springframework.web.method.support.HandlerMethodArgumentResolver;
29 import org.springframework.web.method.support.InvocableHandlerMethod;
30 import org.springframework.web.servlet.mvc.method.annotation.HttpEntityMethodProcessor;
31 import org.springframework.web.servlet.mvc.method.annotation.MatrixVariableMapMethodArgumentResolver;
32 import org.springframework.web.servlet.mvc.method.annotation.MatrixVariableMethodArgumentResolver;
33 import org.springframework.web.servlet.mvc.method.annotation.PathVariableMapMethodArgumentResolver;
34 import org.springframework.web.servlet.mvc.method.annotation.PathVariableMethodArgumentResolver;
35 import org.springframework.web.servlet.mvc.method.annotation.RedirectAttributesMethodArgumentResolver;
36 import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter;
37 import org.springframework.web.servlet.mvc.method.annotation.RequestPartMethodArgumentResolver;
38 import org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor;
39 import org.springframework.web.servlet.mvc.method.annotation.ServletCookieValueMethodArgumentResolver;
40 import org.springframework.web.servlet.mvc.method.annotation.ServletModelAttributeMethodProcessor;
41 import org.springframework.web.servlet.mvc.method.annotation.ServletRequestDataBinderFactory;
42 import org.springframework.web.servlet.mvc.method.annotation.ServletRequestMethodArgumentResolver;
43 import org.springframework.web.servlet.mvc.method.annotation.ServletResponseMethodArgumentResolver;
44 import org.springframework.web.servlet.mvc.method.annotation.UriComponentsBuilderMethodArgumentResolver;
45
46 import java.util.ArrayList;
47 import java.util.List;
48
49
50
51
52
53
54 public class UifRequestMappingHandlerAdapter extends RequestMappingHandlerAdapter {
55
56
57
58
59 @Override
60 protected ServletRequestDataBinderFactory createDataBinderFactory(
61 List<InvocableHandlerMethod> binderMethods) throws Exception {
62 return new UifServletRequestDataBinderFactory(binderMethods, getWebBindingInitializer());
63 }
64
65
66
67
68
69
70 @Override
71 public void afterPropertiesSet() {
72 List<HandlerMethodArgumentResolver> resolvers = getUifArgumentResolvers();
73 setArgumentResolvers(resolvers);
74
75 super.afterPropertiesSet();
76 }
77
78
79
80
81
82 protected List<HandlerMethodArgumentResolver> getUifArgumentResolvers() {
83 List<HandlerMethodArgumentResolver> resolvers = new ArrayList<HandlerMethodArgumentResolver>();
84
85 resolvers.add(new UifDefaultFormMethodArgumentResolver());
86
87
88 resolvers.add(new RequestParamMethodArgumentResolver(getBeanFactory(), false));
89 resolvers.add(new RequestParamMapMethodArgumentResolver());
90 resolvers.add(new PathVariableMethodArgumentResolver());
91 resolvers.add(new PathVariableMapMethodArgumentResolver());
92 resolvers.add(new MatrixVariableMethodArgumentResolver());
93 resolvers.add(new MatrixVariableMapMethodArgumentResolver());
94 resolvers.add(new ServletModelAttributeMethodProcessor(false));
95 resolvers.add(new RequestResponseBodyMethodProcessor(getMessageConverters()));
96 resolvers.add(new RequestPartMethodArgumentResolver(getMessageConverters()));
97 resolvers.add(new RequestHeaderMethodArgumentResolver(getBeanFactory()));
98 resolvers.add(new RequestHeaderMapMethodArgumentResolver());
99 resolvers.add(new ServletCookieValueMethodArgumentResolver(getBeanFactory()));
100 resolvers.add(new ExpressionValueMethodArgumentResolver(getBeanFactory()));
101
102
103 resolvers.add(new ServletRequestMethodArgumentResolver());
104 resolvers.add(new ServletResponseMethodArgumentResolver());
105 resolvers.add(new HttpEntityMethodProcessor(getMessageConverters()));
106 resolvers.add(new RedirectAttributesMethodArgumentResolver());
107 resolvers.add(new ModelMethodProcessor());
108 resolvers.add(new MapMethodProcessor());
109 resolvers.add(new ErrorsMethodArgumentResolver());
110 resolvers.add(new SessionStatusMethodArgumentResolver());
111 resolvers.add(new UriComponentsBuilderMethodArgumentResolver());
112
113
114 if (getCustomArgumentResolvers() != null) {
115 resolvers.addAll(getCustomArgumentResolvers());
116 }
117
118
119 resolvers.add(new RequestParamMethodArgumentResolver(getBeanFactory(), true));
120 resolvers.add(new ServletModelAttributeMethodProcessor(true));
121
122 return resolvers;
123 }
124 }