1
votes

I am trying an inbound http gateway using spring integration . Below is my configuration .

<int:channel id="requestChannel" />
<int:channel id="responseChannel" />


<int-http:inbound-gateway id="inboundEmployeeSearchRequestGateway"
    supported-methods="POST" request-channel="requestChannel"
    reply-channel="responseChannel"
    mapped-response-headers="Return-Status, Return-Status-Msg, HTTP_RESPONSE_HEADERS"
     path="/services/{parama}/{paramb}/search"
    reply-timeout="6000000000">

    <int-http:header name="parama" expression="#pathVariables.parama" />
    <int-http:header name="paramb" expression="#pathVariables.paramb" />

</int-http:inbound-gateway>



<int:service-activator id="activator"
    input-channel="requestChannel" output-channel="responseChannel"
    ref="execSearch" method="execute" requires-reply="true"
    send-timeout="6000000000" />

My Service activator code is as follows :

@Service
public class ExecutionService {

    @Autowired
    private AppDao appDao;

    public SQLResponse execute(Message<?> msg) throws Exception {
        SQLResponse response = new SQLResponse();
        Map<String,String> map = new HashMap<>();
        map.put("name","test");
        response.setResult(map);
        return response;
    }
}

But my response is getting chunked and this happens only if i consume the service using POST , whereas GET functions perfectly fine . Please help

2

2 Answers

0
votes

What app server? I just tried with Tomcat and the Jackson message converter to convert the map to JSON and it doesn't chunk for me.

Which message converter are you using?

What's wrong with chunking anyhow?

0
votes

I am using tomcat and the app is Spring boot based . The following link helped me to resolve this . http://forum.spring.io/forum/spring-projects/integration/109102-content-length-in-http-inbound-gateway-reply-channel . But i didn't need to mention any view resolvers as described in the link . Just had to change mapped-response-headers="Return-Status, Return-Status-Msg, HTTP_RESPONSE_HEADERS" to mapped-response-headers="Content-Type" for the inbound gateway