package com.iailab.module.data.framework.filter;
|
|
import groovy.util.logging.Slf4j;
|
|
import javax.servlet.http.HttpServletRequest;
|
import java.io.BufferedReader;
|
|
@Slf4j
|
public class RequestReadUtils {
|
/**
|
* 读取请求流
|
* @param request
|
* @return
|
*/
|
public static String read(HttpServletRequest request){
|
try(BufferedReader reader = request.getReader()){
|
StringBuilder sb = new StringBuilder();
|
String line;
|
while ((line = reader.readLine()) != null) {
|
sb.append(line);
|
}
|
return sb.toString();
|
}catch (Exception e){
|
throw new RuntimeException("MyHttpServletRequestWrapper.RequestReadUtils.read 获取请求流异常");
|
}
|
}
|
}
|