All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hn.pay.wxpay.utils.HttpKit Maven / Gradle / Ivy

There is a newer version: 1.0.18
Show newest version
package com.hn.pay.wxpay.utils;

import javax.servlet.http.HttpServletRequest;
import java.io.BufferedReader;
import java.io.IOException;

/**
 * 

Http 工具类

* * @author Javen */ public class HttpKit { private static AbstractHttpDelegate delegate = new DefaultHttpKit(); public static AbstractHttpDelegate getDelegate() { return delegate; } public static void setDelegate(AbstractHttpDelegate delegate) { HttpKit.delegate = delegate; } public static String readData(HttpServletRequest request) { BufferedReader br = null; try { StringBuilder result = new StringBuilder(); br = request.getReader(); for (String line; (line=br.readLine())!=null;) { if (result.length() > 0) { result.append("\n"); } result.append(line); } return result.toString(); } catch (IOException e) { throw new RuntimeException(e); } finally { if (br != null) try {br.close();} catch (IOException e) {e.printStackTrace();} } } } /** * 使用 huTool 实现的 Http 工具类 * * @author Javen */ class DefaultHttpKit extends AbstractHttpDelegate { }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy