Using Spring EL to decide which outbound gateway to use
My application can use one of two web services, lets call them WS A and WS
B. Both contain the same interface.
I want to perform some logic on the HTTP headers and request channel. WS B
should only used on certain request channels. To decide which channel is
used I have created a Java class that takes the request channel as a
String parameter.
<http:outbound-gateway request-channel="XXXXX"
url-expression="'${EL EXP}'" http-method="GET"
extract-request-payload="true"
expected-response-type="java.lang.String"
charset="UTF-8" reply-timeout="3000" reply-channel="XXXXX">
</http:outbound-gateway>
I then read that the url-expression is evaluated when the context is
initialised.
source :
http://forum.springsource.org/showthread.php?113446-Usage-of-expressions-in-http-namespace-element-url
<int-http:outbound-gateway request-channel="requestChannel"
url="dummy"
http-method="GET" extract-request-payload="true"
expected-response-type="java.lang.String"
charset="UTF-8" reply-timeout="3000"
reply-channel="sysLoggerRequestChannel">
<int-http:uri-variable name="teststring" expression="test"/>
<int-http:uri-variable name="url"
expression="evalClass.getDestinationForChannel(teststring)"/>
</int-http:outbound-gateway>
The problem with this approach is that the expressions in
int-http:uri-variable do not seem to be evaluation.
All this makes me believe I am taking the wrong approach. Any help would
be very appreciated.
No comments:
Post a Comment