Skip to content

smouki3/TestUserAgentLibrary

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

CIP 39 User Agent Parser

The project is for parsing User Agent String to User Agent Object

###There is a UserAgent class with eight properties

* deviceType

* deviceMaker

* deviceModel

* deviceModelVersion

* os

* osVersion

* browser

* browserVersion

--

###And four Parsing classes:

####UserAgentParser: base abstract class for all parser classes

#####UserAgentUtilsParser: extends UserAgentParser and use UserAgentUtils - library to parse the UAString to an UAObject

#####RegexpUserAgentParser: extends UserAgentParser and use our own RegEx to parse the UAString to an UAObject

#####CompositeUserAgentParser: extends UserAgentParser and this combines the above two classes for more efficiency#

All tree classes @Override parse(String userAgentString) method

--

EXAMPLE

--

*String userAgentString="BlackBerry8520/4.6.1.314 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/301";*

*UserAgentParser userAgentParser = new CompositeUserAgentParser();*

*UserAgent userAgent=userAgentParser.parse(userAgentString);*

*userAgent.getDeviceType();--------------->MOBILE*

*userAgent.getDeviceMaker();-------------->BlackBerry*

*userAgent.getDeviceModel();-------------->8520*

*userAgent.getDeviceModelVersion();------->8520*

*userAgent.getOS();----------------------->BlackBerry*

*userAgent.getOSVersion();---------------->4.6.1.314*

*userAgent.getBrowser();------------------>BlackBerry*

*userAgent.getBrowserVersion();----------->UNKNOWN*

--

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages