java inputStream 获取前台参数

@Override
public boolean preHandle(HttpServletRequest request,
HttpServletResponse response, Object handler) throws Exception {
StringBuffer sb = new StringBuffer() ;
InputStream is = request.getInputStream();
InputStreamReader isr = new InputStreamReader(is); 
BufferedReader br = new BufferedReader(isr);
String s = "" ;
while((s=br.readLine())!=null){
sb.append(s) ;
}
String str =sb.toString();

//防止用get传递参数
if(str.equals("")){
if(request.getQueryString() != null) {
str = request.getRequestURL()+"?"+request.getQueryString();
} else {
str = request.getRequestURL().toString();
}
}
return true;
}

你可能感兴趣的:(jvm)