|
|
|
@ -80,6 +80,7 @@ public class IPUtil { |
|
|
|
|
// System.out.println(InetAddress.getByName("TEST").getHostAddress());
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@SuppressWarnings("AlibabaUndefineMagicConstant") |
|
|
|
|
public String getUserMessage(HttpServletRequest request){ |
|
|
|
|
String browserDetails = request.getHeader("User-Agent"); |
|
|
|
|
String userAgent = browserDetails; |
|
|
|
@ -108,40 +109,50 @@ public class IPUtil { |
|
|
|
|
os = "UnKnown, More-Info: "+userAgent; |
|
|
|
|
} |
|
|
|
|
//===============Browser===========================
|
|
|
|
|
//noinspection AlibabaUndefineMagicConstant
|
|
|
|
|
if (user.contains("edge")) |
|
|
|
|
{ |
|
|
|
|
browser=(userAgent.substring(userAgent.indexOf("Edge")).split(" ")[0]).replace("/", "-"); |
|
|
|
|
} else if (user.contains("msie")) |
|
|
|
|
} else //noinspection AlibabaUndefineMagicConstant
|
|
|
|
|
if (user.contains("msie")) |
|
|
|
|
{ |
|
|
|
|
String substring=userAgent.substring(userAgent.indexOf("MSIE")).split(";")[0]; |
|
|
|
|
browser=substring.split(" ")[0].replace("MSIE", "IE")+"-"+substring.split(" ")[1]; |
|
|
|
|
} else if (user.contains("safari") && user.contains("version")) |
|
|
|
|
} else //noinspection AlibabaUndefineMagicConstant,AlibabaUndefineMagicConstant
|
|
|
|
|
if (user.contains("safari") && user.contains("version")) |
|
|
|
|
{ |
|
|
|
|
browser=(userAgent.substring(userAgent.indexOf("Safari")).split(" ")[0]).split("/")[0] |
|
|
|
|
+ "-" +(userAgent.substring(userAgent.indexOf("Version")).split(" ")[0]).split("/")[1]; |
|
|
|
|
} else if ( user.contains("opr") || user.contains("opera")) |
|
|
|
|
} else //noinspection AlibabaUndefineMagicConstant,AlibabaUndefineMagicConstant
|
|
|
|
|
if ( user.contains("opr") || user.contains("opera")) |
|
|
|
|
{ |
|
|
|
|
//noinspection AlibabaUndefineMagicConstant
|
|
|
|
|
if(user.contains("opera")){ |
|
|
|
|
browser=(userAgent.substring(userAgent.indexOf("Opera")).split(" ")[0]).split("/")[0] |
|
|
|
|
+"-"+(userAgent.substring(userAgent.indexOf("Version")).split(" ")[0]).split("/")[1]; |
|
|
|
|
}else if(user.contains("opr")){ |
|
|
|
|
}else //noinspection AlibabaUndefineMagicConstant
|
|
|
|
|
if(user.contains("opr")){ |
|
|
|
|
browser=((userAgent.substring(userAgent.indexOf("OPR")).split(" ")[0]).replace("/", "-")) |
|
|
|
|
.replace("OPR", "Opera"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} else if (user.contains("chrome")) |
|
|
|
|
} else //noinspection AlibabaUndefineMagicConstant
|
|
|
|
|
if (user.contains("chrome")) |
|
|
|
|
{ |
|
|
|
|
browser=(userAgent.substring(userAgent.indexOf("Chrome")).split(" ")[0]).replace("/", "-"); |
|
|
|
|
} else if ((user.indexOf("mozilla/7.0") > -1) || (user.indexOf("netscape6") != -1) || |
|
|
|
|
} else //noinspection AlibabaUndefineMagicConstant,AlibabaUndefineMagicConstant
|
|
|
|
|
if ((user.indexOf("mozilla/7.0") > -1) || (user.indexOf("netscape6") != -1) || |
|
|
|
|
(user.indexOf("mozilla/4.7") != -1) || (user.indexOf("mozilla/4.78") != -1) || |
|
|
|
|
(user.indexOf("mozilla/4.08") != -1) || (user.indexOf("mozilla/3") != -1) ) |
|
|
|
|
{ |
|
|
|
|
browser = "Netscape-?"; |
|
|
|
|
|
|
|
|
|
} else if (user.contains("firefox")) |
|
|
|
|
} else //noinspection AlibabaUndefineMagicConstant
|
|
|
|
|
if (user.contains("firefox")) |
|
|
|
|
{ |
|
|
|
|
browser=(userAgent.substring(userAgent.indexOf("Firefox")).split(" ")[0]).replace("/", "-"); |
|
|
|
|
} else if(user.contains("rv")) |
|
|
|
|
} else //noinspection AlibabaUndefineMagicConstant
|
|
|
|
|
if(user.contains("rv")) |
|
|
|
|
{ |
|
|
|
|
String IEVersion = (userAgent.substring(userAgent.indexOf("rv")).split(" ")[0]).replace("rv:", "-"); |
|
|
|
|
browser="IE" + IEVersion.substring(0,IEVersion.length() - 1); |
|
|
|
|