RequestMappingHandlerAdapter allows for overriding handleInternal
Issue: SPR-12460
This commit is contained in:
parent
282adeda88
commit
ece2c90e91
|
|
@ -141,9 +141,9 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter
|
||||||
|
|
||||||
private Long asyncRequestTimeout;
|
private Long asyncRequestTimeout;
|
||||||
|
|
||||||
private CallableProcessingInterceptor[] callableInterceptors = new CallableProcessingInterceptor[] {};
|
private CallableProcessingInterceptor[] callableInterceptors = new CallableProcessingInterceptor[0];
|
||||||
|
|
||||||
private DeferredResultProcessingInterceptor[] deferredResultInterceptors = new DeferredResultProcessingInterceptor[] {};
|
private DeferredResultProcessingInterceptor[] deferredResultInterceptors = new DeferredResultProcessingInterceptor[0];
|
||||||
|
|
||||||
private boolean ignoreDefaultModelOnRedirect = false;
|
private boolean ignoreDefaultModelOnRedirect = false;
|
||||||
|
|
||||||
|
|
@ -172,21 +172,18 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter
|
||||||
new LinkedHashMap<ControllerAdviceBean, Set<Method>>();
|
new LinkedHashMap<ControllerAdviceBean, Set<Method>>();
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Default constructor.
|
|
||||||
*/
|
|
||||||
public RequestMappingHandlerAdapter() {
|
public RequestMappingHandlerAdapter() {
|
||||||
|
|
||||||
StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter();
|
StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter();
|
||||||
stringHttpMessageConverter.setWriteAcceptCharset(false); // See SPR-7316
|
stringHttpMessageConverter.setWriteAcceptCharset(false); // see SPR-7316
|
||||||
|
|
||||||
this.messageConverters = new ArrayList<HttpMessageConverter<?>>();
|
this.messageConverters = new ArrayList<HttpMessageConverter<?>>(4);
|
||||||
this.messageConverters.add(new ByteArrayHttpMessageConverter());
|
this.messageConverters.add(new ByteArrayHttpMessageConverter());
|
||||||
this.messageConverters.add(stringHttpMessageConverter);
|
this.messageConverters.add(stringHttpMessageConverter);
|
||||||
this.messageConverters.add(new SourceHttpMessageConverter<Source>());
|
this.messageConverters.add(new SourceHttpMessageConverter<Source>());
|
||||||
this.messageConverters.add(new AllEncompassingFormHttpMessageConverter());
|
this.messageConverters.add(new AllEncompassingFormHttpMessageConverter());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provide resolvers for custom argument types. Custom resolvers are ordered
|
* Provide resolvers for custom argument types. Custom resolvers are ordered
|
||||||
* after built-in ones. To override the built-in support for argument
|
* after built-in ones. To override the built-in support for argument
|
||||||
|
|
@ -330,7 +327,7 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter
|
||||||
* Return the configured message body converters.
|
* Return the configured message body converters.
|
||||||
*/
|
*/
|
||||||
public List<HttpMessageConverter<?>> getMessageConverters() {
|
public List<HttpMessageConverter<?>> getMessageConverters() {
|
||||||
return messageConverters;
|
return this.messageConverters;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -355,10 +352,10 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the configured WebBindingInitializer, or {@code null}.
|
* Return the configured WebBindingInitializer, or {@code null} if none.
|
||||||
*/
|
*/
|
||||||
public WebBindingInitializer getWebBindingInitializer() {
|
public WebBindingInitializer getWebBindingInitializer() {
|
||||||
return webBindingInitializer;
|
return this.webBindingInitializer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -477,9 +474,8 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* A {@link ConfigurableBeanFactory} is expected for resolving expressions
|
||||||
* <p>A {@link ConfigurableBeanFactory} is expected for resolving
|
* in method argument default values.
|
||||||
* expressions in method argument default values.
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setBeanFactory(BeanFactory beanFactory) {
|
public void setBeanFactory(BeanFactory beanFactory) {
|
||||||
|
|
@ -489,15 +485,15 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the owning factory of this bean instance, or {@code null}.
|
* Return the owning factory of this bean instance, or {@code null} if none.
|
||||||
*/
|
*/
|
||||||
protected ConfigurableBeanFactory getBeanFactory() {
|
protected ConfigurableBeanFactory getBeanFactory() {
|
||||||
return this.beanFactory;
|
return this.beanFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterPropertiesSet() {
|
public void afterPropertiesSet() {
|
||||||
|
|
||||||
// Do this first, it may add ResponseBody advice beans
|
// Do this first, it may add ResponseBody advice beans
|
||||||
initControllerAdviceCache();
|
initControllerAdviceCache();
|
||||||
|
|
||||||
|
|
@ -670,6 +666,7 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter
|
||||||
return handlers;
|
return handlers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Always return {@code true} since any method argument and return value
|
* Always return {@code true} since any method argument and return value
|
||||||
* type will be processed in some way. A method argument not recognized
|
* type will be processed in some way. A method argument not recognized
|
||||||
|
|
@ -683,19 +680,8 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* This implementation always returns -1. An {@code @RequestMapping}
|
|
||||||
* method can calculate the lastModified value, call
|
|
||||||
* {@link WebRequest#checkNotModified(long)}, and return {@code null}
|
|
||||||
* if the result of that call is {@code true}.
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected long getLastModifiedInternal(HttpServletRequest request, HandlerMethod handlerMethod) {
|
protected ModelAndView handleInternal(HttpServletRequest request,
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected final ModelAndView handleInternal(HttpServletRequest request,
|
|
||||||
HttpServletResponse response, HandlerMethod handlerMethod) throws Exception {
|
HttpServletResponse response, HandlerMethod handlerMethod) throws Exception {
|
||||||
|
|
||||||
if (getSessionAttributesHandler(handlerMethod).hasSessionAttributes()) {
|
if (getSessionAttributesHandler(handlerMethod).hasSessionAttributes()) {
|
||||||
|
|
@ -722,8 +708,19 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the {@link SessionAttributesHandler} instance for the given
|
* This implementation always returns -1. An {@code @RequestMapping} method can
|
||||||
* handler type, never {@code null}.
|
* calculate the lastModified value, call {@link WebRequest#checkNotModified(long)},
|
||||||
|
* and return {@code null} if the result of that call is {@code true}.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected long getLastModifiedInternal(HttpServletRequest request, HandlerMethod handlerMethod) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the {@link SessionAttributesHandler} instance for the given handler type
|
||||||
|
* (never {@code null}).
|
||||||
*/
|
*/
|
||||||
private SessionAttributesHandler getSessionAttributesHandler(HandlerMethod handlerMethod) {
|
private SessionAttributesHandler getSessionAttributesHandler(HandlerMethod handlerMethod) {
|
||||||
Class<?> handlerType = handlerMethod.getBeanType();
|
Class<?> handlerType = handlerMethod.getBeanType();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue