Linux 常用命令 之 http请求命令 curl
来源:互联网 发布:linux u盘启动盘工具 编辑:程序博客网 时间:2024/05/16 01:57
curl 命令,可以模拟http 请求,这个命令是很方面的。这样的话,结合linux 自带的定时机制 crontab , 我们就可以很轻松地写出定时调用网络请求的接口。
curl 命令参数太多, 笔者用到的是模拟 http post 请求,参数为json 字符串, 希望笔者能起到抛砖引玉的作用。
1. 命令格式:
#!/bin/bashcurl -H "Content-type: application/json" -X \ POST -d '{"requestObject":[ 50, 30 ]}' http://127.0.0.1:7080/ok-controller/hello/sayHello.json
2. springmvc 代码:
spring mvc 修饰的接口,请求参数需要用 @RequestBody 来修饰, 此注解修饰的参数,需使用json 字符串传递,是以字节流传递的,并非在request.getParameter之中,而字节流只能读取一次,不能反复读取。
@RequestMapping("/sayHello.json")@ResponseBodypublic void sayHello(@RequestBody BaseRequest<List<Long>> request){ }
1 0
- Linux 常用命令 之 http请求命令 curl
- Linux curl命令http请求3xx跳转解决办法
- 使用curl命令发送http请求
- 【curl和wget命令】模拟HTTP请求
- Linux命令之curl
- Linux命令之curl
- Linux命令发送Http的get或post请求(curl和wget两种方法)
- Linux命令发送Http的get或post请求(curl和wget两种方法)
- Linux 下curl命令下Http 的get or post请求
- Linux curl命令模拟Http请求(get/post),绑定host访问
- linux命令发送http的get或post请求(curl和wget两种方法)
- Linux命令发送Http的get或post请求(curl和wget两种方法)
- linux用curl命令测试Post请求
- linux命令集锦之curl
- Linux curl命令中,HTTP 302处理
- CURL发送HTTP请求
- curl模拟http请求
- curl 发送http 请求
- angular.foreach 循环方法使用指南
- 常用命令行
- coredata 封装
- 石子合并(一)
- (转)GitHub上README写法暨GFM语法解读
- Linux 常用命令 之 http请求命令 curl
- oralce与mysql分别获取当前系统时间
- 数组指针和指针数组的区别
- C++ STL : advance
- CentOS7安装单机版Hadoop2.7.3
- 配置Oracle 11g Active Dataguard
- ubuntu挂载win共享的文件夹
- 一些杂记
- 杭电2010 ( 水仙花数 ) java