Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Phodal
Coca
提交
c3eb7da8
C
Coca
项目概览
Phodal
/
Coca
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
Coca
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
c3eb7da8
编写于
12月 27, 2019
作者:
P
Phodal Huang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
bug: find the bug files
上级
4a1ab07b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
165 addition
and
0 deletion
+165
-0
_fixtures/bug/AgentUtils.java
_fixtures/bug/AgentUtils.java
+165
-0
未找到文件。
_fixtures/bug/AgentUtils.java
0 → 100644
浏览文件 @
c3eb7da8
/*
* Copyright © 2015 Zhejiang SKT Science Technology Development Co., Ltd. All rights reserved.
* 浙江斯凯特科技发展有限公司 版权所有
* http://www.28844.com
*/
package
com.flycms.core.utils
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
/**
* Open source house, All rights reserved
* 开发公司:28844.com<br/>
* 版权:开源中国<br/>
*
* 移动设置判断
*
* @author 孙开飞 201403020
*
*/
public
class
AgentUtils
{
public
static
boolean
choose
(
String
userAgent
)
{
if
(
userAgent
.
indexOf
(
"Noki"
)
>
-
1
||
// Nokia phones and emulators
userAgent
.
indexOf
(
"Eric"
)
>
-
1
||
// Ericsson WAP phones and emulators
userAgent
.
indexOf
(
"WapI"
)
>
-
1
||
// Ericsson WapIDE 2.0
userAgent
.
indexOf
(
"MC21"
)
>
-
1
||
// Ericsson MC218
userAgent
.
indexOf
(
"AUR"
)
>
-
1
||
// Ericsson R320
userAgent
.
indexOf
(
"R380"
)
>
-
1
||
// Ericsson R380
userAgent
.
indexOf
(
"UP.B"
)
>
-
1
||
// UP.Browser
userAgent
.
indexOf
(
"WinW"
)
>
-
1
||
// WinWAP browser
userAgent
.
indexOf
(
"UPG1"
)
>
-
1
||
// UP.SDK 4.0
userAgent
.
indexOf
(
"upsi"
)
>
-
1
||
// another kind of UP.Browser
userAgent
.
indexOf
(
"QWAP"
)
>
-
1
||
// unknown QWAPPER browser
userAgent
.
indexOf
(
"Jigs"
)
>
-
1
||
// unknown JigSaw browser
userAgent
.
indexOf
(
"Java"
)
>
-
1
||
// unknown Java based browser
userAgent
.
indexOf
(
"Alca"
)
>
-
1
||
// unknown Alcatel-BE3 browser (UP based)
userAgent
.
indexOf
(
"MITS"
)
>
-
1
||
// unknown Mitsubishi browser
userAgent
.
indexOf
(
"MOT-"
)
>
-
1
||
// unknown browser (UP based)
userAgent
.
indexOf
(
"My S"
)
>
-
1
||
// unknown Ericsson devkit browser
userAgent
.
indexOf
(
"WAPJ"
)
>
-
1
||
// Virtual WAPJAG www.wapjag.de
userAgent
.
indexOf
(
"fetc"
)
>
-
1
||
// fetchpage.cgi Perl script from www.wapcab.de
userAgent
.
indexOf
(
"ALAV"
)
>
-
1
||
// yet another unknown UP based browser
userAgent
.
indexOf
(
"Wapa"
)
>
-
1
||
// another unknown browser (Web based "Wapalyzer")
userAgent
.
indexOf
(
"UCWEB"
)
>
-
1
||
// another unknown browser (Web based "Wapalyzer")
userAgent
.
indexOf
(
"BlackBerry"
)
>
-
1
||
// another unknown browser (Web based "Wapalyzer")
userAgent
.
indexOf
(
"J2ME"
)
>
-
1
||
// another unknown browser (Web based "Wapalyzer")
userAgent
.
indexOf
(
"Oper"
)
>
-
1
||
userAgent
.
indexOf
(
"Phone"
)
>
-
1
||
userAgent
.
indexOf
(
"nokia"
)
>
-
1
||
userAgent
.
indexOf
(
"symbian"
)
>
-
1
||
userAgent
.
indexOf
(
"iPhone"
)
>
-
1
||
// 苹果手机ios端
userAgent
.
indexOf
(
"iPad"
)
>
-
1
||
// iPad端
userAgent
.
indexOf
(
"iPod"
)
>
-
1
||
// iPod端
userAgent
.
indexOf
(
"Android"
)
>
-
1
)
{
return
true
;
}
else
{
return
false
;
}
}
/**
* 获取客户端操作系统信息,目前只匹配Win 7、WinXP、Win2003、Win2000、MAC、WinNT、Linux、Mac68k、Win9x
*
* @param userAgent
* request.getHeader("user-agent")的返回值
* @return
*/
public
static
String
getClientOS
(
String
userAgent
)
{
String
cos
=
"unknow os"
;
String
regular
=
".*(Windows NT 6\\.1).*"
;
Pattern
p
=
Pattern
.
compile
(
regular
);
Matcher
m
=
p
.
matcher
(
userAgent
);
if
(
m
.
find
())
{
cos
=
"Win 7"
;
return
cos
;
}
regular
=
".*(Windows NT 5\\.1|Windows XP).*"
;
p
=
Pattern
.
compile
(
regular
);
m
=
p
.
matcher
(
userAgent
);
if
(
m
.
find
())
{
cos
=
"WinXP"
;
return
cos
;
}
regular
=
".*(Windows NT 5\\.2).*"
;
p
=
Pattern
.
compile
(
regular
);
m
=
p
.
matcher
(
userAgent
);
if
(
m
.
find
())
{
cos
=
"Win2003"
;
return
cos
;
}
regular
=
".*(Win2000|Windows 2000|Windows NT 5\\.0).*"
;
p
=
Pattern
.
compile
(
regular
);
m
=
p
.
matcher
(
userAgent
);
if
(
m
.
find
())
{
cos
=
"Win2000"
;
return
cos
;
}
regular
=
".*(Mac|apple|MacOS8).*"
;
p
=
Pattern
.
compile
(
regular
);
m
=
p
.
matcher
(
userAgent
);
if
(
m
.
find
())
{
cos
=
"MAC"
;
return
cos
;
}
regular
=
".*(WinNT|Windows NT).*"
;
p
=
Pattern
.
compile
(
regular
);
m
=
p
.
matcher
(
userAgent
);
if
(
m
.
find
())
{
cos
=
"WinNT"
;
return
cos
;
}
regular
=
".*Linux.*"
;
p
=
Pattern
.
compile
(
regular
);
m
=
p
.
matcher
(
userAgent
);
if
(
m
.
find
())
{
cos
=
"Linux"
;
return
cos
;
}
regular
=
".*(68k|68000).*"
;
p
=
Pattern
.
compile
(
regular
);
m
=
p
.
matcher
(
userAgent
);
if
(
m
.
find
())
{
cos
=
"Mac68k"
;
return
cos
;
}
regular
=
".*(9x 4.90|Win9(5|8)|Windows 9(5|8)|95/NT|Win32|32bit).*"
;
p
=
Pattern
.
compile
(
regular
);
m
=
p
.
matcher
(
userAgent
);
if
(
m
.
find
())
{
cos
=
"Win9x"
;
return
cos
;
}
return
cos
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录