64
64
import org .springframework .web .context .request .WebRequest ;
65
65
import org .springframework .web .context .request .async .AsyncTask ;
66
66
import org .springframework .web .context .request .async .AsyncWebRequest ;
67
- import org .springframework .web .context .request .async .WebAsyncUtils ;
68
67
import org .springframework .web .context .request .async .WebAsyncManager ;
68
+ import org .springframework .web .context .request .async .WebAsyncUtils ;
69
69
import org .springframework .web .method .ControllerAdviceBean ;
70
70
import org .springframework .web .method .HandlerMethod ;
71
71
import org .springframework .web .method .HandlerMethodSelector ;
@@ -115,35 +115,42 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter i
115
115
116
116
private List <HandlerMethodArgumentResolver > customArgumentResolvers ;
117
117
118
+ private HandlerMethodArgumentResolverComposite argumentResolvers ;
119
+
120
+ private HandlerMethodArgumentResolverComposite initBinderArgumentResolvers ;
121
+
118
122
private List <HandlerMethodReturnValueHandler > customReturnValueHandlers ;
119
123
124
+ private HandlerMethodReturnValueHandlerComposite returnValueHandlers ;
125
+
120
126
private List <ModelAndViewResolver > modelAndViewResolvers ;
121
127
128
+ private ContentNegotiationManager contentNegotiationManager = new ContentNegotiationManager ();
129
+
122
130
private List <HttpMessageConverter <?>> messageConverters ;
123
131
124
132
private WebBindingInitializer webBindingInitializer ;
125
133
134
+ private AsyncTaskExecutor taskExecutor = new SimpleAsyncTaskExecutor ("MvcAsync" );
135
+
136
+ private Long asyncRequestTimeout ;
137
+
138
+ private boolean ignoreDefaultModelOnRedirect = false ;
139
+
126
140
private int cacheSecondsForSessionAttributeHandlers = 0 ;
127
141
128
142
private boolean synchronizeOnSession = false ;
129
143
144
+ private SessionAttributeStore sessionAttributeStore = new DefaultSessionAttributeStore ();
145
+
130
146
private ParameterNameDiscoverer parameterNameDiscoverer = new LocalVariableTableParameterNameDiscoverer ();
131
147
132
148
private ConfigurableBeanFactory beanFactory ;
133
149
134
- private SessionAttributeStore sessionAttributeStore = new DefaultSessionAttributeStore ();
135
-
136
- private boolean ignoreDefaultModelOnRedirect = false ;
137
150
138
151
private final Map <Class <?>, SessionAttributesHandler > sessionAttributesHandlerCache =
139
152
new ConcurrentHashMap <Class <?>, SessionAttributesHandler >();
140
153
141
- private HandlerMethodArgumentResolverComposite argumentResolvers ;
142
-
143
- private HandlerMethodArgumentResolverComposite initBinderArgumentResolvers ;
144
-
145
- private HandlerMethodReturnValueHandlerComposite returnValueHandlers ;
146
-
147
154
private final Map <Class <?>, Set <Method >> initBinderCache = new ConcurrentHashMap <Class <?>, Set <Method >>();
148
155
149
156
private final Map <ControllerAdviceBean , Set <Method >> initBinderAdviceCache =
@@ -154,12 +161,6 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter i
154
161
private final Map <ControllerAdviceBean , Set <Method >> modelAttributeAdviceCache =
155
162
new LinkedHashMap <ControllerAdviceBean , Set <Method >>();
156
163
157
- private AsyncTaskExecutor taskExecutor = new SimpleAsyncTaskExecutor ("MvcAsync" );
158
-
159
- private Long asyncRequestTimeout ;
160
-
161
- private ContentNegotiationManager contentNegotiationManager = new ContentNegotiationManager ();
162
-
163
164
164
165
/**
165
166
* Default constructor.
@@ -307,6 +308,14 @@ public void setMessageConverters(List<HttpMessageConverter<?>> messageConverters
307
308
this .messageConverters = messageConverters ;
308
309
}
309
310
311
+ /**
312
+ * Set the {@link ContentNegotiationManager} to use to determine requested media types.
313
+ * If not set, the default constructor is used.
314
+ */
315
+ public void setContentNegotiationManager (ContentNegotiationManager contentNegotiationManager ) {
316
+ this .contentNegotiationManager = contentNegotiationManager ;
317
+ }
318
+
310
319
/**
311
320
* Return the configured message body converters.
312
321
*/
@@ -329,6 +338,49 @@ public WebBindingInitializer getWebBindingInitializer() {
329
338
return webBindingInitializer ;
330
339
}
331
340
341
+ /**
342
+ * Set the default {@link AsyncTaskExecutor} to use when a controller method
343
+ * return a {@link Callable}. Controller methods can override this default on
344
+ * a per-request basis by returning an {@link AsyncTask}.
345
+ * <p>By default a {@link SimpleAsyncTaskExecutor} instance is used.
346
+ * It's recommended to change that default in production as the simple executor
347
+ * does not re-use threads.
348
+ */
349
+ public void setTaskExecutor (AsyncTaskExecutor taskExecutor ) {
350
+ this .taskExecutor = taskExecutor ;
351
+ }
352
+
353
+ /**
354
+ * Specify the amount of time, in milliseconds, before concurrent handling
355
+ * should time out. In Servlet 3, the timeout begins after the main request
356
+ * processing thread has exited and ends when the request is dispatched again
357
+ * for further processing of the concurrently produced result.
358
+ * <p>If this value is not set, the default timeout of the underlying
359
+ * implementation is used, e.g. 10 seconds on Tomcat with Servlet 3.
360
+ * @param timeout the timeout value in milliseconds
361
+ */
362
+ public void setAsyncRequestTimeout (long timeout ) {
363
+ this .asyncRequestTimeout = timeout ;
364
+ }
365
+
366
+ /**
367
+ * By default the content of the "default" model is used both during
368
+ * rendering and redirect scenarios. Alternatively a controller method
369
+ * can declare a {@link RedirectAttributes} argument and use it to provide
370
+ * attributes for a redirect.
371
+ * <p>Setting this flag to {@code true} guarantees the "default" model is
372
+ * never used in a redirect scenario even if a RedirectAttributes argument
373
+ * is not declared. Setting it to {@code false} means the "default" model
374
+ * may be used in a redirect if the controller method doesn't declare a
375
+ * RedirectAttributes argument.
376
+ * <p>The default setting is {@code false} but new applications should
377
+ * consider setting it to {@code true}.
378
+ * @see RedirectAttributes
379
+ */
380
+ public void setIgnoreDefaultModelOnRedirect (boolean ignoreDefaultModelOnRedirect ) {
381
+ this .ignoreDefaultModelOnRedirect = ignoreDefaultModelOnRedirect ;
382
+ }
383
+
332
384
/**
333
385
* Specify the strategy to store session attributes with. The default is
334
386
* {@link org.springframework.web.bind.support.DefaultSessionAttributeStore},
@@ -383,57 +435,6 @@ public void setParameterNameDiscoverer(ParameterNameDiscoverer parameterNameDisc
383
435
this .parameterNameDiscoverer = parameterNameDiscoverer ;
384
436
}
385
437
386
- /**
387
- * By default the content of the "default" model is used both during
388
- * rendering and redirect scenarios. Alternatively a controller method
389
- * can declare a {@link RedirectAttributes} argument and use it to provide
390
- * attributes for a redirect.
391
- * <p>Setting this flag to {@code true} guarantees the "default" model is
392
- * never used in a redirect scenario even if a RedirectAttributes argument
393
- * is not declared. Setting it to {@code false} means the "default" model
394
- * may be used in a redirect if the controller method doesn't declare a
395
- * RedirectAttributes argument.
396
- * <p>The default setting is {@code false} but new applications should
397
- * consider setting it to {@code true}.
398
- * @see RedirectAttributes
399
- */
400
- public void setIgnoreDefaultModelOnRedirect (boolean ignoreDefaultModelOnRedirect ) {
401
- this .ignoreDefaultModelOnRedirect = ignoreDefaultModelOnRedirect ;
402
- }
403
-
404
- /**
405
- * Set the default {@link AsyncTaskExecutor} to use when a controller method
406
- * return a {@link Callable}. Controller methods can override this default on
407
- * a per-request basis by returning an {@link AsyncTask}.
408
- * <p>By default a {@link SimpleAsyncTaskExecutor} instance is used.
409
- * It's recommended to change that default in production as the simple executor
410
- * does not re-use threads.
411
- */
412
- public void setTaskExecutor (AsyncTaskExecutor taskExecutor ) {
413
- this .taskExecutor = taskExecutor ;
414
- }
415
-
416
- /**
417
- * Specify the amount of time, in milliseconds, before concurrent handling
418
- * should time out. In Servlet 3, the timeout begins after the main request
419
- * processing thread has exited and ends when the request is dispatched again
420
- * for further processing of the concurrently produced result.
421
- * <p>If this value is not set, the default timeout of the underlying
422
- * implementation is used, e.g. 10 seconds on Tomcat with Servlet 3.
423
- * @param timeout the timeout value in milliseconds
424
- */
425
- public void setAsyncRequestTimeout (long timeout ) {
426
- this .asyncRequestTimeout = timeout ;
427
- }
428
-
429
- /**
430
- * Set the {@link ContentNegotiationManager} to use to determine requested media types.
431
- * If not set, the default constructor is used.
432
- */
433
- public void setContentNegotiationManager (ContentNegotiationManager contentNegotiationManager ) {
434
- this .contentNegotiationManager = contentNegotiationManager ;
435
- }
436
-
437
438
/**
438
439
* {@inheritDoc}
439
440
* <p>A {@link ConfigurableBeanFactory} is expected for resolving
0 commit comments