Commit 41ff0eb1 authored by zhangyong's avatar zhangyong

1

parent e4af8797
......@@ -82,6 +82,8 @@ public class StringUtil {
return join(sign, before, "", strs.toArray(new String[strs.size()]));
}
/**
*
* @Description 连接字符串
......
package com.egolm.common.web;
import java.net.InetAddress;
import java.net.URLDecoder;
import java.net.UnknownHostException;
import java.util.Enumeration;
import javax.servlet.http.HttpServletRequest;
import com.egolm.common.StringUtil;
import com.egolm.common.exception.PluginException;
public class ServletUtil {
......@@ -34,5 +37,36 @@ public class ServletUtil {
throw new PluginException(e);
}
}
/**
*
* @Description 读取传入的json字符
* @param request
* @return
* @return String
* @throws
* @author 曲欣亮
* @date 2016年5月17日
* @since 2016年5月17日
*/
public static String readReqJson(HttpServletRequest request) {
String json = "";
try {
Enumeration<?> names = request.getParameterNames();
if(names.hasMoreElements()) {
json = (String)names.nextElement();
}
if(json == null || json.length() == 0) {
json = StringUtil.read(request.getReader());
}
} catch (Exception e) {
e.printStackTrace();
}
try {
String encodeJson = URLDecoder.decode(json, "UTF-8");
return encodeJson;
} catch (Exception e) {
e.printStackTrace();
return json;
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment