I have a http-inbound-gateway and I want to retrieve a request parameter to fill in the inbound channel as payload. I find that http-inbound-gateway supports spring expression, so I can use #requestParams to retrieve request parameters. It seems #requestParams is equivalent to request.getParameters('key') which returns a Map but I expect to invoke request.getParameter('key') which returns a String. Currently I have to use new String(#requestParams['key']) to fix this. Is there any better way to do this?
<int-http:inbound-gateway path="/mypath"
supported-methods="GET" payload-expression="new String(#requestParams['key']?:'')"
request-channel="inboundChannel" reply-channel="outboundChannel"
error-channel="errorChannel"
message-converters="stringHttpMessageConverterUsingUtf8">
</int-http:inbound-gateway>