Commit e7123efa authored by 张永's avatar 张永

1

parent b770bb10
......@@ -39,14 +39,14 @@ public class ServletUtil {
throw new PluginException(e);
}
}
/**
*
* @Description 读取传入的json字符
* @param request
* @return
* @return String
* @throws
* @author 曲欣亮
* @throws @author 曲欣亮
* @date 2016年5月17日
* @since 2016年5月17日
*/
......@@ -54,10 +54,10 @@ public class ServletUtil {
String json = "";
try {
Enumeration<?> names = request.getParameterNames();
if(names.hasMoreElements()) {
json = (String)names.nextElement();
if (names.hasMoreElements()) {
json = (String) names.nextElement();
}
if(json == null || json.length() == 0) {
if (json == null || json.length() == 0) {
json = StringUtil.read(request.getReader());
}
} catch (Exception e) {
......@@ -72,7 +72,8 @@ public class ServletUtil {
}
}
public static String covertFileName(HttpServletRequest request, String fileName)throws UnsupportedEncodingException {
public static String covertFileName(HttpServletRequest request, String fileName)
throws UnsupportedEncodingException {
String userAgent = request.getHeader("User-Agent").toLowerCase();
System.out.println(userAgent);
String excelFileName = "";
......@@ -85,4 +86,20 @@ public class ServletUtil {
}
return excelFileName;
}
public static String getHostIp() {
try {
return InetAddress.getLocalHost().getHostAddress();
} catch (UnknownHostException e) {
}
return "127.0.0.1";
}
public static String getHostName() {
try {
return InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException e) {
}
return "未知";
}
}
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