Reputation: 11
I try to use Spring integration as a simple mediator. We have a webapp residing on the intranet which can not be accessed from the outside. Now I want to expose this app through a mediator in the DMZ. This simply means that all url:s like http://gateway/TheApp/* should be forwarded to http://internal/TheApp/*. Really simple in theory but it seems that the component for handling outgoing http-reuests in Spring integration (HttpRequestExecutingMessageHandler) needs an explicut URI, i.e no wildcard matching. Can this be achieved with Spring integration?
Upvotes: 1
Views: 165
Reputation: 174484
The inbound gateway puts the url into a header; you can simply use an expression on the outbound gateway...
url-expression="headers['http_requestUrl'].replace('gateway', 'internal')"
If you are using Java @Configuration
, you can use the constructor that takes an Expression
...
Expression expression = new SpelExpressionParser().parseExpression(
"headers['http_requestUrl'].replace('gateway', 'internal')");
This test case does something similar by grabbing just the query string and appends it to a new URL.
In that case, it puts the query string in the payload; it could easily by added as a header instead (e.g. for a POST), using the <int:header/>
child element.
Upvotes: 1