How do I print the content of httprequest request?

后端 未结 6 524
名媛妹妹
名媛妹妹 2021-01-31 15:04

I\'ve got a bug involving httprequest, which happens sometimes, so I\'d like to log HttpGet and HttpPost request\'s content when that happens.

So, let\'s say, I create H

6条回答
  •  死守一世寂寞
    2021-01-31 15:40

    If you want the content string and this string does not have parameters you can use

        String line = null;
        BufferedReader reader = request.getReader();
        while ((line = reader.readLine()) != null){
            System.out.println(line);
        }
    

提交回复
热议问题