zoukankan      html  css  js  c++  java
  • http post提交数组

    方式一:@RequestParam方式
    服务提供方用@RequestParam注解接收参数,参数类型为long数组:

    @ApiOperation(value = "***", tags = "***", notes = "***", response = ***)
    @RequestMapping(value = "delivery", method = RequestMethod.POST)
    public Object convert(
    @RequestParam(value = "id", required = true) @ApiParam(value = "id数组", required = true) long[] id) {
    return userService.convert(id);
    }

    服务调用方拼接多个id参数请求服务:
    http://**/delivery?id=1&id=2
    方式二:@RequestBody方式
    服务提供方用@RequestBody注解接收参数,参数类型为long数组:

    @ApiOperation(value = "***", tags = "***", notes = "***", response = ***)
    @RequestMapping(value = "/delivery", method = RequestMethod.POST)
    public Object delivery(@RequestBody long[] id) {
    return userService.delivery(id);
    }

    服务调用方把数组放在body中,已application/json方式提交,postman示例如下:
    application/json

  • 相关阅读:
    <span>和<div>标签的隐藏和显示切换
    重启svn
    Mac下配置apache
    iOS时间显示今天昨天
    关于UIPageViewController那些事
    关于plist文件的那些事
    Xcode调试LLDB
    Reveal安装
    静态初始化器
    Static简介
  • 原文地址:https://www.cnblogs.com/jpfss/p/9082777.html
Copyright © 2011-2022 走看看