INT-3461: Add rometools Dependency for SF 4.1

JIRA: https://jira.spring.io/browse/INT-3461

To test it: `gradlew :spring-integration-http:testAll -PspringVersion=4.1.0.BUILD-SNAPSHOT`

INT-3461: Add CP condition for `rometools` into the `HttpRequestHandlingEndpointSupport`

INT-3461: Add CLASSPATH check for `RequestEntity` to determine the SF 4.1
This commit is contained in:
Artem Bilan
2014-07-03 16:23:26 +03:00
committed by Gary Russell
parent db8b164425
commit 7b264e83f4
2 changed files with 14 additions and 3 deletions

View File

@@ -110,11 +110,17 @@ import org.springframework.web.servlet.HandlerMapping;
public abstract class HttpRequestHandlingEndpointSupport extends MessagingGatewaySupport
implements OrderlyShutdownCapable {
private static final boolean spring41Present = ClassUtils.isPresent("org.springframework.http.RequestEntity",
HttpRequestHandlingEndpointSupport.class.getClassLoader());
private static final boolean jaxb2Present = ClassUtils.isPresent("javax.xml.bind.Binder",
HttpRequestHandlingEndpointSupport.class.getClassLoader());
private static boolean romePresent = ClassUtils.isPresent("com.sun.syndication.feed.WireFeed",
HttpRequestHandlingEndpointSupport.class.getClassLoader());
private static boolean romePresent = ClassUtils.isPresent("com.sun.syndication.feed.atom.Feed",
HttpRequestHandlingEndpointSupport.class.getClassLoader());
private static boolean romeToolsPresent = ClassUtils.isPresent("com.rometools.rome.feed.atom.Feed",
HttpRequestHandlingEndpointSupport.class.getClassLoader());
private static final List<HttpMethod> nonReadableBodyHttpMethods =
Arrays.asList(HttpMethod.GET, HttpMethod.HEAD, HttpMethod.OPTIONS);
@@ -173,7 +179,9 @@ public abstract class HttpRequestHandlingEndpointSupport extends MessagingGatewa
logger.debug("'MappingJackson2HttpMessageConverter' was added to the 'defaultMessageConverters'.");
}
}
if (romePresent) {
//The 'rometools' has been introduced since Spring Framework 4.1, hence we should check the version
// of Spring Framework using the class 'org.springframework.http.RequestEntity' from that version.
if ((spring41Present && romeToolsPresent) || romePresent) {
this.defaultMessageConverters.add(new AtomFeedHttpMessageConverter());
this.defaultMessageConverters.add(new RssChannelHttpMessageConverter());
if (logger.isDebugEnabled()) {