Polishing
This commit is contained in:
parent
40cd277b7e
commit
d3ea242085
|
@ -153,14 +153,13 @@ import org.springframework.web.util.UrlPathHelper;
|
||||||
* libraries available on the classpath.
|
* libraries available on the classpath.
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* @see EnableWebMvc
|
|
||||||
* @see WebMvcConfigurer
|
|
||||||
* @see WebMvcConfigurerAdapter
|
|
||||||
*
|
|
||||||
* @author Rossen Stoyanchev
|
* @author Rossen Stoyanchev
|
||||||
* @author Brian Clozel
|
* @author Brian Clozel
|
||||||
* @author Sebastien Deleuze
|
* @author Sebastien Deleuze
|
||||||
* @since 3.1
|
* @since 3.1
|
||||||
|
* @see EnableWebMvc
|
||||||
|
* @see WebMvcConfigurer
|
||||||
|
* @see WebMvcConfigurerAdapter
|
||||||
*/
|
*/
|
||||||
public class WebMvcConfigurationSupport implements ApplicationContextAware, ServletContextAware {
|
public class WebMvcConfigurationSupport implements ApplicationContextAware, ServletContextAware {
|
||||||
|
|
||||||
|
@ -181,18 +180,26 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
|
||||||
ClassUtils.isPresent("com.google.gson.Gson", WebMvcConfigurationSupport.class.getClassLoader());
|
ClassUtils.isPresent("com.google.gson.Gson", WebMvcConfigurationSupport.class.getClassLoader());
|
||||||
|
|
||||||
|
|
||||||
private ServletContext servletContext;
|
|
||||||
|
|
||||||
private ApplicationContext applicationContext;
|
private ApplicationContext applicationContext;
|
||||||
|
|
||||||
|
private ServletContext servletContext;
|
||||||
|
|
||||||
private List<Object> interceptors;
|
private List<Object> interceptors;
|
||||||
|
|
||||||
|
private PathMatchConfigurer pathMatchConfigurer;
|
||||||
|
|
||||||
private ContentNegotiationManager contentNegotiationManager;
|
private ContentNegotiationManager contentNegotiationManager;
|
||||||
|
|
||||||
private List<HttpMessageConverter<?>> messageConverters;
|
private List<HttpMessageConverter<?>> messageConverters;
|
||||||
|
|
||||||
private PathMatchConfigurer pathMatchConfigurer;
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the Spring {@link ApplicationContext}, e.g. for resource loading.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void setApplicationContext(ApplicationContext applicationContext) {
|
||||||
|
this.applicationContext = applicationContext;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the {@link javax.servlet.ServletContext}, e.g. for resource handling,
|
* Set the {@link javax.servlet.ServletContext}, e.g. for resource handling,
|
||||||
|
@ -203,14 +210,6 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
|
||||||
this.servletContext = servletContext;
|
this.servletContext = servletContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the Spring {@link ApplicationContext}, e.g. for resource loading.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void setApplicationContext(ApplicationContext applicationContext) {
|
|
||||||
this.applicationContext = applicationContext;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a {@link RequestMappingHandlerMapping} ordered at 0 for mapping
|
* Return a {@link RequestMappingHandlerMapping} ordered at 0 for mapping
|
||||||
|
@ -239,25 +238,10 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
|
||||||
if (configurer.getUrlPathHelper() != null) {
|
if (configurer.getUrlPathHelper() != null) {
|
||||||
handlerMapping.setUrlPathHelper(configurer.getUrlPathHelper());
|
handlerMapping.setUrlPathHelper(configurer.getUrlPathHelper());
|
||||||
}
|
}
|
||||||
|
|
||||||
return handlerMapping;
|
return handlerMapping;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected PathMatchConfigurer getPathMatchConfigurer() {
|
|
||||||
if (this.pathMatchConfigurer == null) {
|
|
||||||
this.pathMatchConfigurer = new PathMatchConfigurer();
|
|
||||||
configurePathMatch(this.pathMatchConfigurer);
|
|
||||||
}
|
|
||||||
return this.pathMatchConfigurer;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Override this method to configure path matching options.
|
|
||||||
* @see PathMatchConfigurer
|
|
||||||
* @since 4.0.3
|
|
||||||
*/
|
|
||||||
public void configurePathMatch(PathMatchConfigurer configurer) {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provide access to the shared handler interceptors used to configure
|
* Provide access to the shared handler interceptors used to configure
|
||||||
* {@link HandlerMapping} instances with. This method cannot be overridden,
|
* {@link HandlerMapping} instances with. This method cannot be overridden,
|
||||||
|
@ -282,6 +266,27 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
|
||||||
protected void addInterceptors(InterceptorRegistry registry) {
|
protected void addInterceptors(InterceptorRegistry registry) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback for building the {@link PathMatchConfigurer}.
|
||||||
|
* Delegates to {@link #configurePathMatch}.
|
||||||
|
* @since 4.1
|
||||||
|
*/
|
||||||
|
protected PathMatchConfigurer getPathMatchConfigurer() {
|
||||||
|
if (this.pathMatchConfigurer == null) {
|
||||||
|
this.pathMatchConfigurer = new PathMatchConfigurer();
|
||||||
|
configurePathMatch(this.pathMatchConfigurer);
|
||||||
|
}
|
||||||
|
return this.pathMatchConfigurer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Override this method to configure path matching options.
|
||||||
|
* @see PathMatchConfigurer
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
public void configurePathMatch(PathMatchConfigurer configurer) {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a {@link ContentNegotiationManager} instance to use to determine
|
* Return a {@link ContentNegotiationManager} instance to use to determine
|
||||||
* requested {@linkplain MediaType media types} in a given request.
|
* requested {@linkplain MediaType media types} in a given request.
|
||||||
|
@ -295,8 +300,8 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
|
||||||
try {
|
try {
|
||||||
this.contentNegotiationManager = configurer.getContentNegotiationManager();
|
this.contentNegotiationManager = configurer.getContentNegotiationManager();
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception ex) {
|
||||||
throw new BeanInitializationException("Could not create ContentNegotiationManager", e);
|
throw new BeanInitializationException("Could not create ContentNegotiationManager", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return this.contentNegotiationManager;
|
return this.contentNegotiationManager;
|
||||||
|
@ -680,7 +685,6 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
|
||||||
public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
|
public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return an instance of {@link CompositeUriComponentsContributor} for use with
|
* Return an instance of {@link CompositeUriComponentsContributor} for use with
|
||||||
* {@link org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder}.
|
* {@link org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder}.
|
||||||
|
|
Loading…
Reference in New Issue