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

查看:81
本文介绍了寻找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发行后,您无需重新编译任何内容.您只能在应用程序的lib目录中切换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天全站免登陆