|
|
|
@ -20,7 +20,6 @@ import java.util.ArrayList; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
|
import javax.servlet.ServletContext; |
|
|
|
import javax.servlet.ServletContext; |
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import javax.xml.transform.Source; |
|
|
|
import javax.xml.transform.Source; |
|
|
|
@ -143,6 +142,9 @@ import org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolv |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class WebMvcConfigurationSupport implements ApplicationContextAware, ServletContextAware { |
|
|
|
public class WebMvcConfigurationSupport implements ApplicationContextAware, ServletContextAware { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static boolean romePresent = |
|
|
|
|
|
|
|
ClassUtils.isPresent("com.sun.syndication.feed.WireFeed", WebMvcConfigurationSupport.class.getClassLoader()); |
|
|
|
|
|
|
|
|
|
|
|
private static final boolean jaxb2Present = |
|
|
|
private static final boolean jaxb2Present = |
|
|
|
ClassUtils.isPresent("javax.xml.bind.Binder", WebMvcConfigurationSupport.class.getClassLoader()); |
|
|
|
ClassUtils.isPresent("javax.xml.bind.Binder", WebMvcConfigurationSupport.class.getClassLoader()); |
|
|
|
|
|
|
|
|
|
|
|
@ -154,8 +156,6 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv |
|
|
|
ClassUtils.isPresent("org.codehaus.jackson.map.ObjectMapper", WebMvcConfigurationSupport.class.getClassLoader()) && |
|
|
|
ClassUtils.isPresent("org.codehaus.jackson.map.ObjectMapper", WebMvcConfigurationSupport.class.getClassLoader()) && |
|
|
|
ClassUtils.isPresent("org.codehaus.jackson.JsonGenerator", WebMvcConfigurationSupport.class.getClassLoader()); |
|
|
|
ClassUtils.isPresent("org.codehaus.jackson.JsonGenerator", WebMvcConfigurationSupport.class.getClassLoader()); |
|
|
|
|
|
|
|
|
|
|
|
private static boolean romePresent = |
|
|
|
|
|
|
|
ClassUtils.isPresent("com.sun.syndication.feed.WireFeed", WebMvcConfigurationSupport.class.getClassLoader()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private ServletContext servletContext; |
|
|
|
private ServletContext servletContext; |
|
|
|
|
|
|
|
|
|
|
|
@ -225,9 +225,9 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv |
|
|
|
InterceptorRegistry registry = new InterceptorRegistry(); |
|
|
|
InterceptorRegistry registry = new InterceptorRegistry(); |
|
|
|
addInterceptors(registry); |
|
|
|
addInterceptors(registry); |
|
|
|
registry.addInterceptor(new ConversionServiceExposingInterceptor(mvcConversionService())); |
|
|
|
registry.addInterceptor(new ConversionServiceExposingInterceptor(mvcConversionService())); |
|
|
|
interceptors = registry.getInterceptors(); |
|
|
|
this.interceptors = registry.getInterceptors(); |
|
|
|
} |
|
|
|
} |
|
|
|
return interceptors.toArray(); |
|
|
|
return this.interceptors.toArray(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
@ -264,12 +264,12 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv |
|
|
|
map.put("atom", MediaType.APPLICATION_ATOM_XML); |
|
|
|
map.put("atom", MediaType.APPLICATION_ATOM_XML); |
|
|
|
map.put("rss", MediaType.valueOf("application/rss+xml")); |
|
|
|
map.put("rss", MediaType.valueOf("application/rss+xml")); |
|
|
|
} |
|
|
|
} |
|
|
|
if (jackson2Present || jacksonPresent) { |
|
|
|
|
|
|
|
map.put("json", MediaType.APPLICATION_JSON); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (jaxb2Present) { |
|
|
|
if (jaxb2Present) { |
|
|
|
map.put("xml", MediaType.APPLICATION_XML); |
|
|
|
map.put("xml", MediaType.APPLICATION_XML); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (jackson2Present || jacksonPresent) { |
|
|
|
|
|
|
|
map.put("json", MediaType.APPLICATION_JSON); |
|
|
|
|
|
|
|
} |
|
|
|
return map; |
|
|
|
return map; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -552,6 +552,7 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv |
|
|
|
messageConverters.add(new ResourceHttpMessageConverter()); |
|
|
|
messageConverters.add(new ResourceHttpMessageConverter()); |
|
|
|
messageConverters.add(new SourceHttpMessageConverter<Source>()); |
|
|
|
messageConverters.add(new SourceHttpMessageConverter<Source>()); |
|
|
|
messageConverters.add(new AllEncompassingFormHttpMessageConverter()); |
|
|
|
messageConverters.add(new AllEncompassingFormHttpMessageConverter()); |
|
|
|
|
|
|
|
|
|
|
|
if (romePresent) { |
|
|
|
if (romePresent) { |
|
|
|
messageConverters.add(new AtomFeedHttpMessageConverter()); |
|
|
|
messageConverters.add(new AtomFeedHttpMessageConverter()); |
|
|
|
messageConverters.add(new RssChannelHttpMessageConverter()); |
|
|
|
messageConverters.add(new RssChannelHttpMessageConverter()); |
|
|
|
|