From acaf357d729d0482c482d24b264e6a690a2c16cb Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Mon, 18 May 2015 08:58:22 +0300 Subject: [PATCH] INT-3687: Fix CORS & upgrade to IO 2.0 JIRA: https://jira.spring.io/browse/INT-3687 * Change `master` to use IO 2.0 BOM for versions * Upgrade `jsonPath` to `2.0.0` * Fix `IntegrationRequestMappingHandlerMapping` according the latest MVC changes around CORS: https://jira.spring.io/browse/SPR-12933. * No yet any tests for `Global CORS`: waiting for Namespace support in MVC Test this with: ``` ./gradlew clean springIoCheck -PplatformVersion=2.0.0.BUILD-SNAPSHOT -PJDK8_HOME= ``` --- build.gradle | 4 ++-- .../IntegrationRequestMappingHandlerMapping.java | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 3795c9ed32..ddbb749220 100644 --- a/build.gradle +++ b/build.gradle @@ -61,7 +61,7 @@ subprojects { subproject -> apply plugin: 'spring-io' dependencies { - springIoVersions "io.spring.platform:platform-versions:${platformVersion}@properties" + springIoVersions "io.spring.platform:platform-bom:${platformVersion}@properties" } } @@ -104,7 +104,7 @@ subprojects { subproject -> jpaApiVersion = '2.0.0' jrubyVersion = '1.7.19' jschVersion = '0.1.52' - jsonpathVersion = '1.2.0' + jsonpathVersion = '2.0.0' junitVersion = '4.11' jythonVersion = '2.5.3' log4jVersion = '1.2.17' diff --git a/spring-integration-http/src/main/java/org/springframework/integration/http/inbound/IntegrationRequestMappingHandlerMapping.java b/spring-integration-http/src/main/java/org/springframework/integration/http/inbound/IntegrationRequestMappingHandlerMapping.java index 69d8186214..7bf07bb1a9 100644 --- a/spring-integration-http/src/main/java/org/springframework/integration/http/inbound/IntegrationRequestMappingHandlerMapping.java +++ b/spring-integration-http/src/main/java/org/springframework/integration/http/inbound/IntegrationRequestMappingHandlerMapping.java @@ -90,11 +90,24 @@ public final class IntegrationRequestMappingHandlerMapping extends RequestMappin protected final HandlerExecutionChain getHandlerExecutionChain(Object handler, HttpServletRequest request) { if (handler instanceof HandlerMethod) { HandlerMethod handlerMethod = (HandlerMethod) handler; - handler = handlerMethod.getBean(); + Object bean = handlerMethod.getBean(); + if (bean instanceof HttpRequestHandlingEndpointSupport) { + handler = bean; + } } return super.getHandlerExecutionChain(handler, request); } + @Override + protected CorsConfiguration getCorsConfiguration(Object handler, HttpServletRequest request) { + if (handler instanceof HandlerMethod) { + return super.getCorsConfiguration(handler, request); + } + else { + return super.getCorsConfiguration(new HandlerMethod(handler, HANDLE_REQUEST_METHOD), request); + } + } + @Override protected final void detectHandlerMethods(Object handler) { if (handler instanceof String) {