WURFL, the Wireless Universal Resource FiLe, is a Device Description Repository (DDR), i.e. a software component that maps HTTP Request headers to the profile of the HTTP client (Desktop, Mobile Device, Tablet, etc.) that issued the request.
相关地址:
http://sourceforge.net/projects/wurfl/files/
https://docs.scientiamobile.com/documentation/onsite/onsite-java-api
https://filex.scientiamobile.com/user/index#products/OnSite/Java_API/1.6.4.1
需要登录
https://github.com/WURFL/wurfl-cloud-client-java
云检测,支持不断更新
----------------------------以下是个人的设置-----------------------
package com.caiya.login.web.utils;
import org.apache.commons.lang3.Validate;
import javax.servlet.http.HttpServletRequest;
import java.util.regex.Pattern;
/**
* 平台/设备检测工具类
* Created by caiya on 16/1/13.
*/
public class DeviceDetectionUtils {
/**
* 判断"android","iphone","windows phone","meego","ipad"四个移动平台
* This method parse the Http request to find the user-agent string. It
* search the <code>User-Agent</code> header value.
*
* @param request The <code>HttpServletRequest</code> to parse. It must be not
* null value.
* @return The user-agent string reported by the Http request.
*/
public static boolean isMobile(HttpServletRequest request) {
try {
String user_agent = request.getHeader("User-Agent").toLowerCase();
String[] deviceArray = new String[]{"android", "iphone", "windows phone", "meego", "ipad"};
for (String device : deviceArray) {
if (user_agent.indexOf(device) > 0) {
return true;
}
}
} catch (Exception e) {
return false;
}
return false;
}
}