kotlin spring mvc request json 请求
// json 代码
{ /*用户信息*/
user: {
username: '{$user.username}',
headImg: '{$user.headImg}',
targetId: '{$user.targetId}',
openid: '{$user.openid}'
}, /* 产品信息 */
productUrl: '',
productImg: '',
productPrice: ''
}
// 后台代码
class ConnController {
/**
* 普通用户初始连接时请求。
*/
class UserInitReq {
var user: User = User()
}
@Autowired
lateinit var connService: ConnService
@PostMapping("/userToKfConn")
@ResponseBody
fun userToKfConn(@RequestBody userInitReq: UserInitReq,
req: HttpServletRequest,
resp: HttpServletResponse): Map<String, Any?> {
return connService.handlerUserToKfConn(req, resp, userInitReq.user)
}
}
前台发送 post (json)请求,后台是用这个方法接收
kotlin spring mvc request json 请求的更多相关文章
- spring mvc返回json字符串的方式
spring mvc返回json字符串的方式 方案一:使用@ResponseBody 注解返回响应体 直接将返回值序列化json 优点:不需要自己再处理 步骤一:在spring- ...
- ajax使用向Spring MVC发送JSON数据出现 org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported错误
ajax使用向Spring MVC发送JSON数据时,后端Controller在接受JSON数据时报org.springframework.web.HttpMediaTypeNotSupportedE ...
- Spring MVC的映射请求
一.SpringMVC常用注解 @Controller 声明Action组件 @Service 声明Service组件 @Service("myMovieLister" ...
- Spring MVC 异步处理请求,提高程序性能
原文:http://blog.csdn.net/he90227/article/details/52262163 什么是异步模式 如何在Spring MVC中使用异步提高性能? 一个普通 Servle ...
- Spring mvc 启动 和 请求分发
Spring mvc 启动 和 请求分发 启动加载: abstract class HttpServletBean extends HttpServlet void init() initServle ...
- Spring MVC 处理一个请求的流程分析
Spring MVC是Spring系列框架中使用频率最高的部分.不管是Spring Boot还是传统的Spring项目,只要是Web项目都会使用到Spring MVC部分.因此程序员一定要熟练掌握MV ...
- spring mvc返回json字符串数据,只需要返回一个java bean对象就行,只要这个java bean 对象实现了序列化serializeable
1.spring mvc返回json数据,只需要返回一个java bean对象就行,只要这个java bean 对象实现了序列化serializeable 2. @RequestMapping(val ...
- An overview of the Spring MVC request flow
The Spring MVC request flow in short: When we enter a URL in the browser, the request comes to the d ...
- Spring Mvc 输出Json(iwantmoon.com出品)
原文:http://iwantmoon.com/Post/f94e49caf9b6455db7158474bab4c4dd 因为工作需要,现在要去做开放平台,考虑了多种方案之后,基本确定 下来,Htt ...
随机推荐
- 在zookeeper集群的基础上,搭建solrCloud
1 将在window中部署的单机版solr上传到node-01中 cd /export/software/ rz 选择资料中的solr.zip进行上传(此zip就是 solr的简单部署:在tomca ...
- 【HDU6026】Deleting Edges
题意 有一个n个节点的无向图,结点编号从0-n-1,每条边的长度时1to9的一个正整数.现在要删除一些边(或者不删),使得到的新图满足下面两个要求. 1.新图是一颗树有n-1条边2.对于每个结点v(0 ...
- 520. Detect Capital判断单词有效性
[抄题]: Given a word, you need to judge whether the usage of capitals in it is right or not. We define ...
- R语言安装包,切换镜像
source("http://bioconductor.org/biocLite.R") options(BioC_mirror="http://mirrors.ustc ...
- 3.Dynamic Layout 动态布局。在槽中处理布局
在应用程序中,一个界面的布局基本都是固定的. 在这个实例中,我们把管理布局的代码放在槽中.这样点击一次按钮,触发槽.布局改变一次.这样就成为一个动态布局. (一) 水平和竖直布局改变 横向: 纵向: ...
- Appium移动端自动化测试之应用操作详解(四)
应用操作篇 1.1).安装应用 desired_caps = { 'platformName': 'Android', 'platformVersion': '5.0.0.0', 'deviceNam ...
- C# 文本输入限制类型,datagridview单元格输入验证
1.只能输入double类型 private void textBoxX6_KeyPress(object sender, KeyPressEventArgs e) { { //数字0~9所对应的ke ...
- DOM--sql server
public List<LianHeData> select(int ID) { List<LianHeData> list = new List<LianHeData& ...
- MongoDB单表导出与导入
mongoexport -h -u dbAdmin -p L-$LpGQ=FJvSf*****([l --authenticationDatabase=project_core_db -d proje ...
- 从头开始学eShopOnContainers——Visual Studio 2017环境配置
一.安装和配置Docker环境 1.安装Docker CE for Windows 从官方网站下载并安装,https://docs.docker.com/docker-for-windows/inst ...