看代码中遇到的难点

来源:互联网 发布:阿里云退款 编辑:程序博客网 时间:2024/06/05 18:26

@RequestBody:该注解用于读取Request请求的body部分数据

java读取http请求中的body:在http请求中,有Header和Body之分,读取header使用request.getHeader(“…”);https://www.baidu.com/s?wd=%40ResponseBody&rsv_spt=1&issp=1&f=3&rsv_bp=0&rsv_idx=2&ie=utf-8&tn=baiduhome_pg&rsv_enter=0&sug=eclipse&oq=ec&inputT=2412

读取Body使用request.getReader(),但getReader获取的是BufferedReader,需要把它转换成字符串,下面是转换的方法。https://www.baidu.com/s?wd=Request%E8%AF%B7%E6%B1%82%E7%9A%84body&rsv_spt=1&issp=1&f=3&rsv_bp=0&rsv_idx=2&ie=utf-8&tn=baiduhome_pg&rsv_enter=0&sug=eclipse&oq=ec&inputT=1090

http请求:

Class clazz:

0 0