org.wings.session
Class Browser

java.lang.Object
  extended by org.wings.session.Browser
All Implemented Interfaces:
Serializable

public class Browser
extends Object
implements Serializable

Detect the browser from the user-agent string passed in the HTTP header.

Author:
Andre Lison
See Also:
Serialized Form

Constructor Summary
Browser(String agent)
          Create a new browser object and start scanning for browser, os and client language in given string.
 
Method Summary
protected  void detect()
          That does all the work.
 String getBrowserName()
          Get the browser browserName (Mozilla, MSIE, Opera etc.).
 BrowserType getBrowserType()
          Gets the classification of the browser, this can be either GECKO, IE, KONQUEROR, MOZILLA, OPERA or UNKNOWN.
 Locale getClientLocale()
          Get the browser/client locale.
 int getMajorVersion()
          Get the browser major version.
 double getMinorVersion()
          Get the minor version.
 String getOs()
          Get the operating system string provided by the browser.
 OSType getOsType()
          Get the operating system type.
 String getOsVersion()
          Get the operating system version.
 String getRelease()
          Get additional information about browser version.
static void main(String[] args)
          just for testing ...
 String toString()
          Get a full human readable representation of the browser.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Browser

public Browser(String agent)
Create a new browser object and start scanning for browser, os and client language in given string.

Parameters:
agent - the "User-Agent" string from the request.
Method Detail

getBrowserName

public String getBrowserName()
Get the browser browserName (Mozilla, MSIE, Opera etc.).


getBrowserType

public BrowserType getBrowserType()
Gets the classification of the browser, this can be either GECKO, IE, KONQUEROR, MOZILLA, OPERA or UNKNOWN.

Returns:
A classification of the browser BrowserType

getMajorVersion

public int getMajorVersion()
Get the browser major version.
f.e. the major version for Netscape 6.2 is 6.

Returns:
the major version or 0 if not found

getMinorVersion

public double getMinorVersion()
Get the minor version. This is the number after the dot in the version string.
f.e. the minor version for Netscape 6.01 is 0.01.

Returns:
the minor version if found, 0 otherwise

getRelease

public String getRelease()
Get additional information about browser version.
f.e. the release for MSIE 6.1b is b.

Returns:
the release or null, if not available.

getOs

public String getOs()
Get the operating system string provided by the browser. OSType

Returns:
the os browserName or null, if not available.

getOsVersion

public String getOsVersion()
Get the operating system version.

Returns:
the os version or null, if not available.

getOsType

public OSType getOsType()
Get the operating system type.

Returns:
A valid OSType

getClientLocale

public Locale getClientLocale()
Get the browser/client locale.

Returns:
the found locale or the default server locale specified by Locale.getDefault() if not found.

detect

protected void detect()
That does all the work.


main

public static void main(String[] args)
just for testing ...


toString

public String toString()
Get a full human readable representation of the browser.

Overrides:
toString in class Object


wingS Swings ;-)