寻找 Java 用户代理字符串解析器 [英] Looking for a Java User Agent String Parser

查看:29
本文介绍了寻找 Java 用户代理字符串解析器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道 java 中有一个很棒的用于解析用户代理字符串的库?我们已经写了一个自定义的,但这对很多人来说似乎是一个常见的问题.我猜想某处有一个很好的图书馆.

Does anyone know of a great library in java for parsing user agent strings? We have written a custom one, but this seems like a common problem for many people. I would guess there is a good library available somewhere.

例如,用户代理字符串...

For example, the user agent string...

Mozilla/5.0(Windows;U;Windows NT 6.0;en-US)AppleWebKit/532.0(KHTML,如 Gecko)Chrome/3.0.195.21 Safari/532.0"

"Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/3.0.195.21 Safari/532.0"

...在我们的网站上神秘地宣布一台使用 Chrome 的 Windows Vista PC 的到来.

... cryptically announces the arrival of a Windows Vista PC using Chrome on our site.

我见过 python 和 ruby​​ 中的库.java中有什么东西吗?

I've seen libraries in python and ruby. Anything in java out there?

推荐答案

尝试一个新的库,该库每月更新一次,可在中央存储库中使用:http://uadetector.sourceforge.net/

Yet try a new library that is updated monthly and available in The Central Repository: http://uadetector.sourceforge.net/

它是 user-agent-string.info 的另一个包装器,但具有更可靠和与其他实现相比,经过测试的实现.

It is another wrapper for user-agent-string.info, but with a much more solid and tested implementation compared to the other ones.

我正在开发稳定的 API 1.0,我想在今年年底发布.API 1.0 发布后,您无需重新编译任何内容.您只需在应用程序库目录中切换 uadetector-resources.jar.每月更新"功能意味着,如果您想要一个经过集成测试的UAS 数据"文件,您可以保证它与定义的核心一起运行,那么这个文件适合您的需求.但是,如果您对更新 JAR(由我测试过)不感兴趣,那么您可以使用 OnlineUserAgentStringParser,但存在风险,即该实现不适合使用自动下载的 XML 运行.我对根据需要发布更多uadetector-core"包不感兴趣,尤其是在发布 1.0 版 API 时.

I'm working on a stable API 1.0 which I want to release at the end of this year. After the release of API 1.0 you don't have to recompile anything. You only switch the uadetector-resources.jar in your applications lib dir. The feature 'updated monthly' means, if you want an integration tested 'UAS data' file, for which you have the guarantee that it runs with the defined core, than this one fit your needs. But if you are not interested in updating a JAR (that is tested by me), then you can use the OnlineUserAgentStringParser with the risk, that the implementation doesn't fit to run with the automatically downloaded XML. I'm not interested in releasing more 'uadetector-core' bundles as needed, especially when the API in version 1.0 is released.

客户的另一个解决方案可能是当他使用 OnlineUserAgentStringParser 并自定义属性文件以设置正确的 URL 时,他为其自己维护UAS 数据".

Another solution for a client might be that he maintains the 'UAS data' for it's own, when he works with the OnlineUserAgentStringParser and customize the properties file to set the right URL.

这篇关于寻找 Java 用户代理字符串解析器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆