diff --git a/src/reference/asciidoc/gateway.adoc b/src/reference/asciidoc/gateway.adoc index 19f87722d0f..cdf3c35add3 100644 --- a/src/reference/asciidoc/gateway.adoc +++ b/src/reference/asciidoc/gateway.adoc @@ -158,6 +158,7 @@ IMPORTANT: If you specify, for example, the `requestChannel` in `` NOTE: If a no-argument gateway is specified in XML, and the interface method has both a `@Payload` and `@Gateway` annotation (with a `payloadExpression` or a `payload-expression` in an `` element), the `@Payload` value is ignored. +[[gateway-expressions]] ===== Expressions and "`Global`" Headers The `
` element supports `expression` as an alternative to `value`. @@ -225,10 +226,10 @@ public interface MyGateway { void twoMapsAndOneAnnotatedWithPayload(@Payload Map payload, Map headers); - @Payload("#args[0] + #args[1] + '!'") + @Payload("args[0] + args[1] + '!'") void payloadAnnotationAtMethodLevel(String a, String b); - @Payload("@someBean.exclaim(#args[0])") + @Payload("@someBean.exclaim(args[0])") void payloadAnnotationAtMethodLevelUsingBeanResolver(String s); void payloadAnnotationWithExpression(@Payload("toUpperCase()") String s); @@ -254,17 +255,17 @@ public interface MyGateway { <1> Note that, in this example, the SpEL variable, `#this`, refers to the argument -- in this case, the value of `s`. The XML equivalent looks a little different, since there is no `#this` context for the method argument. -However, expressions can refer to method arguments by using the `#args` variable, as the following example shows: +However, expressions can refer to method arguments by using the `args` property for the `MethodArgsHolder` root object (see <> for more information), as the following example shows: ==== [source,xml] ---- - - - + + + - + ---- @@ -515,23 +516,23 @@ Starting with version 5.0, the timeouts can be defined as expressions, as the fo ==== [source, java] ---- -@Gateway(payloadExpression = "#args[0]", requestChannel = "someChannel", - requestTimeoutExpression = "#args[1]", replyTimeoutExpression = "#args[2]") +@Gateway(payloadExpression = "args[0]", requestChannel = "someChannel", + requestTimeoutExpression = "args[1]", replyTimeoutExpression = "args[2]") String lateReply(String payload, long requestTimeout, long replyTimeout); ---- ==== -The evaluation context has a `BeanResolver` (use `@someBean` to reference other beans), and the `#args` array variable is available. - +The evaluation context has a `BeanResolver` (use `@someBean` to reference other beans), and the `args` array property from the `#root` object is available. +See <> for more information about this root object. When configuring with XML, the timeout attributes can be a long value or a SpEL expression, as the following example shows: ==== [source, xml] ---- + reply-timeout="args[1]"> ---- ====