java - HTTP Inbound adapter Differentiate between supported-methods -
i have http inbound adapter defined -
<int-http:inbound-channel-adapter id="httpinboundadapter" channel="receivechannel" name="/inboundadapter.htm" supported-methods="get, post" /> <int:channel id="receivechannel"/> <int:service-activator input-channel="receivechannel" expression="@sayhello.sayhello(payload)" />
i able differentiate between , post request , respond differently them. how can ..?
the message on receivechannel
have header http_requestmethod
set 'get' or 'post'.
you can use expression="@sayhello.sayhello(payload, headers['http_requestmethod'])"
, second parameter string.
to avoid hard-coding literal, can use headers[t(org.springframework.integration.http.httpheaders).request_method]
.
fyi request_url
, user_principal
populated; and, on adapter/gateway, populate other headers http request parameters or uri variables.
Comments
Post a Comment