java - 如何使用 java spring 在 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 process(@RequestBody String[] list) {
...
}
但我有一个例外。HttpMediaTypeNotSupportedException:不支持内容类型“application/x-www-form-urlencoded;charset=UTF-8”。
如果我删除@RequestBody
我的列表变量将只是空。谁能帮我?
解决方案
推荐阅读
- ubuntu - vscode ubuntu asp .net core 3.1服务在调用api请求时立即以代码0退出
- javascript - 元素在选择下拉材质 ui 中重叠
- java - 如何在 Android 中使用 Google 地图 Api(地理编码)从 Edittext 返回地址的 latlong
- ios - 在 deleteRows 之后 TableView reloadData
- c++ - 如何口头区分所有形式的新?
- python - 如何将音乐上传到 Spotify、iTunes 等网站
- variables - gforth:如何检查变量是否设置为 arg 值
- javascript - aspnet 中的谷歌图表
- html - css伪元素曲线背景定位
- javascript - Discord.js 缺少 API 权限 [防止节点进程被终止]