Reputation: 499
I have a problem with sending GET requests to my HTTP resource. I can't control the client side requests and Spring seems to think that they want to do multipart requests. But they don't do that, they are just sending me JSON in the payload.
It works fine in POST requests but in GET requests I receive an empty LinkedMultiValueMap. I have tried a few methods but I wasn't able to disable the multipart feature.
<int:channel id="myChannel" />
<int-http:inbound-gateway request-channel="myChannel"
supported-methods="GET,POST"
path="/testResource"
request-payload-type="java.util.Map">
</int-http:inbound-gateway>
<int:service-activator ref="TestEndPoint"
method="testMethod"
input-channel="myChannel" />
<bean id="TestEndPoint" class="com.example.TestEndPoint" />
This is my test method:
public Message<?> testMethod(Message<Map> message)
{
Map payload = message.getPayload();
// Do stuff with the payload, create a result...
return MessageBuilder.withPayload(result)
.setHeader(HttpHeaders.STATUS_CODE, HttpStatus.OK)
.build();
}
How can I disable the multipart feature or is there a better way to handle this?
Note: I'm aware of this property but it does not fix the problem:
spring.servlet.multipart.enabled=false
Upvotes: 1
Views: 244