httpServletRequest 中body的内容

 	@Autowired
    private pervice perviceService;
	@RequestMapping(value = "/add", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("获取信息")
    public OfferOrderReturn add(HttpServletRequest request, HttpServletResponse response) {
        try {
            //request获取输入流
            BufferedReader reader = new BufferedReader(new InputStreamReader(request.getInputStream()));
            //读取输入流的内容转换为String类型IOUtils必须引入org.apache.dubbo.common.utils.IOUtils;包
            String body = IOUtils.read(reader);
            System.out.println(body );
            perviceService.index(body);
        } catch (Exception e) {
            LOG.info("*****存在问题*****");
        } finally {
        }
        //如果需要返回值并且try有返回值此时只需要返回null
        return null;
    }

你可能感兴趣的:(小知识,1024程序员节,servlet,java)