com.spinglobe.javasniff
Class BrowserSniffer

java.lang.Object
  extended by com.spinglobe.javasniff.BrowserSniffer
All Implemented Interfaces:
java.io.Serializable

public class BrowserSniffer
extends java.lang.Object
implements java.io.Serializable

A server side class which determines the client's web browser environment based on the user-agent field of the request object
Notes:

Version:
$Revision: 1.0.3 $ $Date: 2007/04/19 11:22:00 $
Author:
Stephen Smith
See Also:
Serialized Form

Field Summary
static java.lang.String BROWSER_AMAYA
           
static java.lang.String BROWSER_AMIGAAWEB
           
static java.lang.String BROWSER_AMIGAVOYAGER
           
static java.lang.String BROWSER_BROWSEX
           
static java.lang.String BROWSER_CAMINO
           
static java.lang.String BROWSER_CHIMERA
           
static java.lang.String BROWSER_EPIPHANY
           
static java.lang.String BROWSER_FIREBIRD
           
static java.lang.String BROWSER_FIREFOX
           
static java.lang.String BROWSER_GALEON
           
static java.lang.String BROWSER_HOTJAVA
           
static java.lang.String BROWSER_IBROWSE
           
static java.lang.String BROWSER_ICAB
           
static java.lang.String BROWSER_IE
           
static java.lang.String BROWSER_KMELEON
           
static java.lang.String BROWSER_KONQUEROR
           
static java.lang.String BROWSER_LINKS
           
static java.lang.String BROWSER_LYNX
           
static java.lang.String BROWSER_MOSAIC
           
static java.lang.String BROWSER_MOZILLA
           
static java.lang.String BROWSER_NETSCAPE
           
static java.lang.String BROWSER_OMNIWEB
           
static java.lang.String BROWSER_OPERA
           
static java.lang.String BROWSER_OTHER
           
static java.lang.String BROWSER_PHOENIX
           
static java.lang.String BROWSER_SAFARI
           
 java.lang.String browserName
           
protected static org.apache.commons.logging.Log log
           
 java.lang.String longName
           
 java.lang.String majorVersion
           
 java.lang.String minorVersion
           
static java.lang.String MSIE_ID
           
static java.lang.String NETSCAPE_ID
           
static java.lang.String OPERA_ID
           
 java.lang.String os
           
 java.lang.String platform
           
static java.lang.String PLATFORM_AMIGA
           
static java.lang.String PLATFORM_MAC
           
static java.lang.String PLATFORM_OS2
           
static java.lang.String PLATFORM_OTHER
           
static java.lang.String PLATFORM_UNIX
           
static java.lang.String PLATFORM_WIN
           
static java.lang.String REQUEST_HEADER_USER_AGENT
           
 java.lang.String revisionVersion
           
 
Constructor Summary
BrowserSniffer(javax.servlet.http.HttpServletRequest req)
          Create a new BrowserSniffer
 
Method Summary
 java.lang.String getBrowserName()
           
 java.lang.String getLongName()
           
 java.lang.String getMajorVersion()
           
 java.lang.String getMinorVersion()
           
 java.lang.String getOs()
           
 java.lang.String getPlatform()
           
 java.lang.String getRevisionVersion()
           
 java.lang.String getUa()
           
 boolean isBrowser(java.lang.String browserID)
           
 boolean isFirefox()
           
 boolean isIE()
           
 boolean isMac()
           
 boolean isMozilla()
           
 boolean isNetscape()
           
 boolean isOpera()
           
 boolean isPlatform(java.lang.String platformID)
           
 boolean isSafari()
           
 boolean isWindows()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.apache.commons.logging.Log log

REQUEST_HEADER_USER_AGENT

public static final java.lang.String REQUEST_HEADER_USER_AGENT
See Also:
Constant Field Values

PLATFORM_WIN

public static final java.lang.String PLATFORM_WIN
See Also:
Constant Field Values

PLATFORM_AMIGA

public static final java.lang.String PLATFORM_AMIGA
See Also:
Constant Field Values

PLATFORM_OS2

public static final java.lang.String PLATFORM_OS2
See Also:
Constant Field Values

PLATFORM_MAC

public static final java.lang.String PLATFORM_MAC
See Also:
Constant Field Values

PLATFORM_UNIX

public static final java.lang.String PLATFORM_UNIX
See Also:
Constant Field Values

PLATFORM_OTHER

public static final java.lang.String PLATFORM_OTHER
See Also:
Constant Field Values

BROWSER_IE

public static final java.lang.String BROWSER_IE
See Also:
Constant Field Values

BROWSER_NETSCAPE

public static final java.lang.String BROWSER_NETSCAPE
See Also:
Constant Field Values

BROWSER_GALEON

public static final java.lang.String BROWSER_GALEON
See Also:
Constant Field Values

BROWSER_PHOENIX

public static final java.lang.String BROWSER_PHOENIX
See Also:
Constant Field Values

BROWSER_FIREBIRD

public static final java.lang.String BROWSER_FIREBIRD
See Also:
Constant Field Values

BROWSER_FIREFOX

public static final java.lang.String BROWSER_FIREFOX
See Also:
Constant Field Values

BROWSER_CHIMERA

public static final java.lang.String BROWSER_CHIMERA
See Also:
Constant Field Values

BROWSER_CAMINO

public static final java.lang.String BROWSER_CAMINO
See Also:
Constant Field Values

BROWSER_EPIPHANY

public static final java.lang.String BROWSER_EPIPHANY
See Also:
Constant Field Values

BROWSER_SAFARI

public static final java.lang.String BROWSER_SAFARI
See Also:
Constant Field Values

BROWSER_KMELEON

public static final java.lang.String BROWSER_KMELEON
See Also:
Constant Field Values

BROWSER_MOZILLA

public static final java.lang.String BROWSER_MOZILLA
See Also:
Constant Field Values

BROWSER_OPERA

public static final java.lang.String BROWSER_OPERA
See Also:
Constant Field Values

BROWSER_KONQUEROR

public static final java.lang.String BROWSER_KONQUEROR
See Also:
Constant Field Values

BROWSER_ICAB

public static final java.lang.String BROWSER_ICAB
See Also:
Constant Field Values

BROWSER_LYNX

public static final java.lang.String BROWSER_LYNX
See Also:
Constant Field Values

BROWSER_LINKS

public static final java.lang.String BROWSER_LINKS
See Also:
Constant Field Values

BROWSER_MOSAIC

public static final java.lang.String BROWSER_MOSAIC
See Also:
Constant Field Values

BROWSER_AMAYA

public static final java.lang.String BROWSER_AMAYA
See Also:
Constant Field Values

BROWSER_OMNIWEB

public static final java.lang.String BROWSER_OMNIWEB
See Also:
Constant Field Values

BROWSER_HOTJAVA

public static final java.lang.String BROWSER_HOTJAVA
See Also:
Constant Field Values

BROWSER_BROWSEX

public static final java.lang.String BROWSER_BROWSEX
See Also:
Constant Field Values

BROWSER_AMIGAVOYAGER

public static final java.lang.String BROWSER_AMIGAVOYAGER
See Also:
Constant Field Values

BROWSER_AMIGAAWEB

public static final java.lang.String BROWSER_AMIGAAWEB
See Also:
Constant Field Values

BROWSER_IBROWSE

public static final java.lang.String BROWSER_IBROWSE
See Also:
Constant Field Values

BROWSER_OTHER

public static final java.lang.String BROWSER_OTHER
See Also:
Constant Field Values

MSIE_ID

public static final java.lang.String MSIE_ID
See Also:
Constant Field Values

OPERA_ID

public static final java.lang.String OPERA_ID
See Also:
Constant Field Values

NETSCAPE_ID

public static final java.lang.String NETSCAPE_ID
See Also:
Constant Field Values

longName

public java.lang.String longName

browserName

public java.lang.String browserName

majorVersion

public java.lang.String majorVersion

minorVersion

public java.lang.String minorVersion

revisionVersion

public java.lang.String revisionVersion

platform

public java.lang.String platform

os

public java.lang.String os
Constructor Detail

BrowserSniffer

public BrowserSniffer(javax.servlet.http.HttpServletRequest req)
Create a new BrowserSniffer

Parameters:
req - the HttpServletRequest from which to grab the user-agent field
Method Detail

getUa

public java.lang.String getUa()
Returns:
Returns the user-agent string.

getBrowserName

public java.lang.String getBrowserName()
Returns:
Returns the browserName.

getLongName

public java.lang.String getLongName()
Returns:
Returns the longName.

getMajorVersion

public java.lang.String getMajorVersion()
Returns:
Returns the majorVersion.

getMinorVersion

public java.lang.String getMinorVersion()
Returns:
Returns the minorVersion.

getOs

public java.lang.String getOs()
Returns:
Returns the os.

getPlatform

public java.lang.String getPlatform()
Returns:
Returns the platform.

getRevisionVersion

public java.lang.String getRevisionVersion()
Returns:
Returns the revisionVersion.

isBrowser

public boolean isBrowser(java.lang.String browserID)

isPlatform

public boolean isPlatform(java.lang.String platformID)

isWindows

public boolean isWindows()

isMac

public boolean isMac()

isIE

public boolean isIE()

isSafari

public boolean isSafari()

isOpera

public boolean isOpera()

isNetscape

public boolean isNetscape()

isMozilla

public boolean isMozilla()

isFirefox

public boolean isFirefox()


Copyright © 2005-2007 spinglobe inc. All Rights Reserved.