标签:pac string block blog generated 处理 auto let generate
package etcom.servlet; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import javax.servlet.http.HttpServletRequest; public class IoToJsonUtils { public static String getIoToJson(HttpServletRequest request,String code){ String jsonString = null; try { InputStream in = request.getInputStream(); InputStreamReader isr = new InputStreamReader(in,code); BufferedReader reader = new BufferedReader(isr); String inputString = null; StringBuffer stringBuffer = new StringBuffer(); while ((inputString = reader.readLine()) != null) { stringBuffer.append(inputString); } reader.close(); jsonString = stringBuffer.toString(); System.out.println(jsonString); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return jsonString; } }
Servlet里面request处理外部POST请求的输入流的工具类
标签:pac string block blog generated 处理 auto let generate
原文地址:http://www.cnblogs.com/zhncnblogs/p/7543558.html