HTTP Inbound adapter Differentiate between supported-methods

I have a http inbound adapter defined like so -

<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 would like to be able to differentiate between a GET and POST request and respond differently to them. How I can do that ..?

Answers


The message on receiveChannel will have a header http_requestMethod set to 'GET' or 'POST'.

You can use expression="@sayHello.sayHello(payload, headers['http_requestMethod'])", where the second parameter is a String.

To avoid hard-coding the literal, you can use headers[T(org.springframework.integration.http.HttpHeaders).REQUEST_METHOD].

FYI REQUEST_URL and USER_PRINCIPAL are also populated; and, on the adapter/gateway, you also populate other headers with http request parameters or URI variables.


Need Your Help

java jpg pixel editing

java image compression rgb steganography

I had a question concerning jpg image creation ImageIO.write(imgStega, "jpeg", file) :

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.