I have an HTTP inbound channel adapter so configured:
<int-http:inbound-channel-adapter id="/api/requests"
channel="httpRequestsChannel"
path="/requests"
supported-methods="POST,OPTIONS">
<int-http:cross-origin allow-credentials="false" allowed-headers="*" origin="*" />
</int-http:inbound-channel-adapter>
I'd like to make it reply 201 to POST
requests and 200 to others (i.e. OPTIONS
), but none of:
headers.get('http_requestMethod').equals("POST") ? 201 : 200
:headers[http_requestMethod].equals("POST") ? 201 : 200
"POST".equals(:headers['http_requestMethod']) ? 201 : 200
for the status-code-expression
attribute worked, most of them end in a failed context initialization with:
IllegalStateException: No node
Am I using the wrong syntax here or those details aren't available at that stage?
I've seen this question where a gateway is suggested, but I'd like to stick with the adapter for now.