18人参与 • 2025-10-17 • Javascript
1.用来处理content-type: 为 application/x-www-form-urlencoded编码的内容。
(http协议中,如果不指定content-type,则默认传递的参数就是application/x-www-form-urlencoded类型)
@requestparam可以接受简单类型的属性,也可以接受对象类型。
2.用来处理 multipart/form-data (表单上传的)
const message = {
"data": {
"userinfo": "2804951212",
"offerid": offerid,
"action": "distribution",
"categorynav": categorynav
},
"gmtborn": time,
"msgid": time,
"type": "product_collection",
"userinfo": "chrome"
};
$.ajax({
contenttype :'application/x-www-form-urlencoded',
type:'post',
url: baseurl+'/ali-receive',
data:"message="+json.stringify(message)
});
@postmapping("/ali-receive")
public void alireceive(@requestparam("message") string message) {
receivelog receivelog = json.parseobject(message, receivelog.class);
}
@requestbody
一般用来处理 content-type: 为application/json
以上为个人经验,希望能给大家一个参考,也希望大家多多支持代码网。
您想发表意见!!点此发布评论
版权声明:本文内容由互联网用户贡献,该文观点仅代表作者本人。本站仅提供信息存储服务,不拥有所有权,不承担相关法律责任。 如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 2386932994@qq.com 举报,一经查实将立刻删除。
发表评论