[INT-2570] Add support for URL Expression for Http Outbound adapter/gateway Created: 18/May/12  Updated: 13/Dec/12  Resolved: 25/May/12

Status: Closed
Project: Spring Integration
Component/s: None
Affects Version/s: 2.2 M1
Fix Version/s: 2.2 M2

Type: New Feature Priority: Minor
Reporter: Oleg Zhurakousky Assignee: Gary Russell
Resolution: Complete Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relate
is related to INT-2569 Refactor HttpOutboundGateway to mitig... Closed

 Description   

Based on the changes that are described in INT-2569 (which is actually a mitigation to avoid breaking change and not really a recommended way of doing things) we need to provide this attribute to formally support ability to provide URL dynamically
For example:
Instead of

<int-http:outbound-gateway url="{url}" request-channel="vmwChannel" reply-channel="replyChannel"
					expected-response-type="java.lang.String" http-method="GET">
	<int-http:uri-variable name="url" expression="payload" encode="false"/>
</int-http:outbound-gateway>

we'f have something like

<int-http:outbound-gateway url-expression="payload" request-channel="vmwChannel" reply-channel="replyChannel"
					expected-response-type="java.lang.String" http-method="GET"/>



 Comments   
Comment by Gary Russell [ 24/May/12 ]

PR Issued: https://github.com/SpringSource/spring-integration/pull/458

Comment by Gary Russell [ 25/May/12 ]

Missed some DFA tests

Comment by dheerja arora [ 06/Dec/12 ]

I implemented url expression but getting

Comment by dheerja arora [ 06/Dec/12 ]

preSend on channel 'requestChannel1', message: [Payload=http://api.pdn.coupons.com/cpr/shopping/16681/users/100829679/lists/19a3862b-779a-4a65-ba5a-2968205345ca?gwauth_token=8038e590-58b9-4deb-86fa-9638c3b94e6e&ts=1354788235&sig=1d5bca4e615ed4481922161c66571d232525de03]
Caused by: java.lang.IllegalStateException: Could not create URI object: Illegal character in scheme name at index 0: %22http://api.pdn.coupons.com/cpr/shopping/16681/users/100829679/lists/19a3862b-779a-4a65-ba5a-2968205345ca?gwauth_token=8038e590-58b9-4deb-86fa-9638c3b94e6e&ts=1354788235&sig=1d5bca4e615ed4481922161c66571d232525de03%22
at org.springframework.web.util.UriComponents.toUri(UriComponents.java:533)
at org.springframework.web.util.UriTemplate.expand(UriTemplate.java:103)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:408)
at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:384)
at org.springframework.integration.http.outbound.HttpRequestExecutingMessageHandler.handleRequestMessage(HttpRequestExecutingMessageHandler.java:351)
... 34 more

Comment by Mark Fisher [ 06/Dec/12 ]

Please do not double post in JIRA. The same information was reported as a bug (even though it appears to be a mis-configuration) here: INT-2850

Comment by dheerja arora [ 13/Dec/12 ]

The above example explains the scenario in case of Get call.
How do we handle when we have a Post call with a request body and a dynamic url
If i try putting both(string url , object ) in the payload it gives me an error - Cannot add 2 objects in payload.
Please suggest how do I handle Post calls

Comment by Mark Fisher [ 13/Dec/12 ]

Please post usage questions on the forum and not in JIRA:
http://forum.springsource.org/forumdisplay.php?42-Integration

Even if you think there might be a bug, it's best to post in the forum first. Someone responding there would be able to let you know whether to escalate it to JIRA. In this case though, you are asking a question that can be addressed by reading the manual or posting to the forum.

Generated at Sat Dec 16 07:19:27 UTC 2017 using JIRA 6.4.14#64029-sha1:ae256fe0fbb912241490ff1cecfb323ea0905ca5.