Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

upgraded to SI 2.2.0 and changed http outbound to use url-expression …

…attribute if url is a closure
  • Loading branch information...
commit 2fe95cc0611d67e1f868eaeb2a6424b149d68f65 1 parent 71f9d93
David Turanski authored
View
4 gradle.properties
@@ -2,7 +2,5 @@ version = 1.0.0.BUILD-SNAPSHOT
junitVersion = 4.8.2
log4jVersion = 1.2.14
mockitoVersion = 1.9.0
-#springIntegrationVersion = 2.2.0.RC1
-springIntegrationVersion = 2.1.3.RELEASE
-
+springIntegrationVersion = 2.2.0.RC2
groovyVersion = 2.0.5
View
26 ...org/springframework/integration/dsl/groovy/http/builder/dom/HttpOutboundDomBuilder.groovy
@@ -53,24 +53,22 @@ class HttpOutboundDomBuilder extends IntegrationComponentDomBuilder {
Closure urlExpression
- attributes.url = component.url
+
if (component.url instanceof Closure) {
urlExpression = component.url
- attributes.url = '{url}'
+ def beanName = "${component.name}_closureInvokingHandler"
+ BeanDefinitionBuilder handlerBuilder =
+ BeanDefinitionBuilder.genericBeanDefinition(ClosureInvokingMessageProcessor)
+ handlerBuilder.addConstructorArgValue(urlExpression)
+ def bdh = new BeanDefinitionHolder(handlerBuilder.getBeanDefinition(),beanName)
+ BeanDefinitionReaderUtils.registerBeanDefinition(bdh, (BeanDefinitionRegistry) applicationContext)
+
+ attributes.'url-expression' = "@${beanName}.processMessage(#this)"
+ } else {
+ attributes.url = component.url
}
- builder.'int-http:outbound-gateway'(attributes) {
- if (urlExpression){
- def beanName = "${component.name}_closureInvokingHandler"
- BeanDefinitionBuilder handlerBuilder =
- BeanDefinitionBuilder.genericBeanDefinition(ClosureInvokingMessageProcessor)
- handlerBuilder.addConstructorArgValue(urlExpression)
- def bdh = new BeanDefinitionHolder(handlerBuilder.getBeanDefinition(),beanName)
- BeanDefinitionReaderUtils.registerBeanDefinition(bdh, (BeanDefinitionRegistry) applicationContext)
-
- 'int-http:uri-variable'(name:'url', expression:"@${beanName}.processMessage(#this)")
- }
- }
+ builder.'int-http:outbound-gateway'(attributes)
}
}
View
10 ...-samples/src/main/groovy/org/springframework/integration/samples/http/HttpExamples.groovy
@@ -12,15 +12,15 @@ public class HttpExamples {
static void main(String[] args) {
def builder = new IntegrationBuilder('http')
builder.setAutoCreateApplicationContext(false)
-
- def ticker = 'VMW'
+ /*
+ * Demonstrates defining url as a closure
+ */
def flow = builder.messageFlow {
-
- httpGet(url:"http://www.google.com/finance/info?q=$ticker",responseType:String)
+ httpGet(url:{"http://www.google.com/finance/info?q=$it"},responseType:String)
}
- def result = flow.sendAndReceive('')
+ def result = flow.sendAndReceive('VMW')
println result
}
View
2  spring-integration-dsl-groovy-samples/src/main/resources/log4j.xml
@@ -13,7 +13,7 @@
<!-- Loggers -->
<logger name="org.springframework.integration.dsl.groovy">
- <level value="warn" />
+ <level value="debug" />
</logger>
<logger name="org.springframework.integration">
Please sign in to comment.
Something went wrong with that request. Please try again.