如何使用JavaSpring处理curl中的字符串数组
我想实现一个名为process的postmapping方法,该方法接收此类调用:如何使用JavaSpring处理curl中的字符串数组,java,spring-mvc,curl,Java,Spring Mvc,Curl,我想实现一个名为process的postmapping方法,该方法接收此类调用: curl -d '["a", "b", "c"]' "http://localhost:8080/process" 因此,我使用以下模板实现了ta方法: @RequestMapping(value = "/process", method = RequestMethod.POST, consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) List proce
curl -d '["a", "b", "c"]' "http://localhost:8080/process"
因此,我使用以下模板实现了ta方法:
@RequestMapping(value = "/process", method = RequestMethod.POST, consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
List process(@RequestBody String[] list) {
...
}
但我有个例外。HttpMediaTypeNotSupportedException:内容
输入'application/x-www-form-urlencoded;字符集=UTF-8'不受支持
如果我删除@RequestBody
,我的列表变量将为空。有人能帮我吗