// 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 请求的更多相关文章

  1. spring mvc返回json字符串的方式

    spring mvc返回json字符串的方式 方案一:使用@ResponseBody 注解返回响应体 直接将返回值序列化json            优点:不需要自己再处理 步骤一:在spring- ...

  2. 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 ...

  3. Spring MVC的映射请求

    一.SpringMVC常用注解 @Controller 声明Action组件 @Service    声明Service组件    @Service("myMovieLister" ...

  4. Spring MVC 异步处理请求,提高程序性能

    原文:http://blog.csdn.net/he90227/article/details/52262163 什么是异步模式 如何在Spring MVC中使用异步提高性能? 一个普通 Servle ...

  5. Spring mvc 启动 和 请求分发

    Spring mvc 启动 和 请求分发 启动加载: abstract class HttpServletBean extends HttpServlet void init() initServle ...

  6. Spring MVC 处理一个请求的流程分析

    Spring MVC是Spring系列框架中使用频率最高的部分.不管是Spring Boot还是传统的Spring项目,只要是Web项目都会使用到Spring MVC部分.因此程序员一定要熟练掌握MV ...

  7. spring mvc返回json字符串数据,只需要返回一个java bean对象就行,只要这个java bean 对象实现了序列化serializeable

    1.spring mvc返回json数据,只需要返回一个java bean对象就行,只要这个java bean 对象实现了序列化serializeable 2. @RequestMapping(val ...

  8. 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 ...

  9. Spring Mvc 输出Json(iwantmoon.com出品)

    原文:http://iwantmoon.com/Post/f94e49caf9b6455db7158474bab4c4dd 因为工作需要,现在要去做开放平台,考虑了多种方案之后,基本确定 下来,Htt ...

随机推荐

  1. 带你剖析WebGis的世界奥秘----瓦片式加载地图(转)

    带你剖析WebGis的世界奥秘----瓦片式加载地图 转:https://zxhtom.oschina.io/zxh/20160805.html  编程  java  2016/08/05 0留言,  ...

  2. CURL以 POST 请求链接的方式 初始化一个cURL会话来获取一个网页

    /** *POST URL */ function posturl($URL,$data) { $ch = curl_init(); // 创建一个新cURL资源 curl_setopt($ch,CU ...

  3. vim 的小幅移动

    1.操作符命令和位移 x --->删除一个字符,4x ---->删除4个字符. dw --->可以删除一个单词,d4w ---->删除4个单词. d$  ----> 删除 ...

  4. 717. 1-bit and 2-bit Characters最后一位数是否为0

    [抄题]: We have two special characters. The first character can be represented by one bit 0. The secon ...

  5. jQuery--基础知识速查表

    一.jQuery选择器 选择器 实例 选取 * $("*") 所有元素 #id $("#lastname") id="lastname" 的 ...

  6. 32.GROUP BY

    合计函数 (比如 SUM) 常常需要添加 GROUP BY 语句. GROUP BY 语句 GROUP BY 语句用于结合合计函数,根据一个或多个列对结果集进行分组. SQL GROUP BY 语法 ...

  7. 用js获取cookie

    //获取cookiefunction cookie_email(cookie_name){ var cookiestr = document.cookie; if (cookiestr.length ...

  8. ESP8266文档阅读ESP8266 SDK 入门指南

    ESP8266 SDK  入门指南 1.概述 1.2.ESP8266 HDK 1.3.ESP8266 SDK 1.4.ESP8266 FW 1.5.ESP8266 工具集 2.1.开发板方案 3.软件 ...

  9. 在Global.asax文件的Application_BeginRequest中获取request请求内容

    protected void Application_BeginRequest(object sender, EventArgs e) { try { string isLogRequest = Sy ...

  10. SVN下载地址及注意事项

    SVN下载地址:VisualSVN:http://www.visualsvn.com/server/download     服务器端(添加仓库和用户)TortoiseSVN:http://torto ...